diff --git a/doc/en/plugins_index/test_plugins_index.expected.rst b/doc/en/plugins_index/test_plugins_index.expected.rst deleted file mode 100644 index 2f51ad821..000000000 --- a/doc/en/plugins_index/test_plugins_index.expected.rst +++ /dev/null @@ -1,16 +0,0 @@ -.. _plugins_index: - -List of Third-Party Plugins -=========================== - -============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== - Name Author Downloads Python 2.7 Python 3.3 Summary -============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== - `pytest-plugin1-1.0 `_ `someone `_ 4 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py27&pytest=2.X.Y .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py33&pytest=2.X.Y some plugin - `pytest-plugin2-1.2 `_ `other `_ 40 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py27&pytest=2.X.Y .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py33&pytest=2.X.Y some other plugin - -============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== - -*(Downloads are given from last month only)* - -*(Updated on 2013-10-20)* diff --git a/doc/en/plugins_index/test_plugins_index.py b/doc/en/plugins_index/test_plugins_index.py deleted file mode 100644 index 84e3da970..000000000 --- a/doc/en/plugins_index/test_plugins_index.py +++ /dev/null @@ -1,96 +0,0 @@ -import os - -import pytest - - -@pytest.mark.xfail(reason="not a core pytest test") -def test_plugins_index(tmpdir, monkeypatch): - """ - Blackbox testing for plugins_index script. Calls main() generating a file - and compares produced output to expected. - - .. note:: if the test fails, a file named - `test_plugins_index.obtained.rst` will be generated in the same directory - as this test file. Ensure the contents are correct and overwrite - `test_plugins_index.expected.rst` with that file. - """ - import plugins_index - - # dummy interface to xmlrpclib.ServerProxy - class DummyProxy(object): - - expected_url = 'http://dummy.pypi' - - def __init__(self, url): - assert url == self.expected_url - - def search(self, query): - assert query == {'name': 'pytest-'} - return [ - {'name': 'pytest-plugin1', 'version': '0.8'}, - {'name': 'pytest-plugin1', 'version': '1.0'}, - {'name': 'pytest-plugin2', 'version': '1.2'}, - ] - - def release_data(self, package_name, version): - results = { - ('pytest-plugin1', '1.0'): { - 'package_url': 'http://plugin1', - 'release_url': 'http://plugin1/1.0', - 'author': 'someone', - 'author_email': 'someone@py.com', - 'summary': 'some plugin', - 'downloads': {'last_day': 1, 'last_month': 4, - 'last_week': 2}, - }, - - ('pytest-plugin2', '1.2'): { - 'package_url': 'http://plugin2', - 'release_url': 'http://plugin2/1.2', - 'author': 'other', - 'author_email': 'other@py.com', - 'summary': 'some other plugin', - 'downloads': {'last_day': 10, 'last_month': 40, - 'last_week': 20}, - }, - } - return results[(package_name, version)] - - - monkeypatch.setattr(plugins_index, 'get_proxy', lambda url: DummyProxy(url), - 'foo') - monkeypatch.setattr(plugins_index, '_get_today_as_str', - lambda: '2013-10-20') - - output_file = str(tmpdir.join('output.rst')) - assert plugins_index.main( - ['', '-f', output_file, '-u', DummyProxy.expected_url]) == 0 - - with open(output_file, 'rU') as f: - obtained_output = f.read() - expected_output = get_expected_output() - - if obtained_output != expected_output: - obtained_file = os.path.splitext(__file__)[0] + '.obtained.rst' - with open(obtained_file, 'w') as f: - f.write(obtained_output) - - assert obtained_output == expected_output - - -def get_expected_output(): - """ - :return: string with expected rst output from the plugins_index.py script. - """ - expected_filename = os.path.join(os.path.dirname(__file__), - 'test_plugins_index.expected.rst') - expected_output = open(expected_filename, 'rU').read() - return expected_output.replace('pytest=2.X.Y', - 'pytest={0}'.format(pytest.__version__)) - - -#=============================================================================== -# main -#=============================================================================== -if __name__ == '__main__': - pytest.main()