{ "info": { "author": "Adam Johnson", "author_email": "me@adamj.eu", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only" ], "description": "================\npytest-flake8dir\n================\n\n.. image:: https://img.shields.io/travis/adamchainz/pytest-flake8dir/master.svg\n :target: https://travis-ci.org/adamchainz/pytest-flake8dir\n\n.. image:: https://img.shields.io/pypi/v/pytest-flake8dir.svg\n :target: https://pypi.python.org/pypi/pytest-flake8dir\n\nA pytest fixture for testing flake8 plugins.\n\nA quick example:\n\n.. code-block:: python\n\n def test_simple_run(flake8dir):\n flake8dir.make_example_py('''\n x = 1\n ''')\n result = flake8dir.run_flake8()\n assert result.out_lines == [\n './example.py:1:2: E221 multiple spaces before operator'\n ]\n\nInstallation\n============\n\nUse **pip**:\n\n.. code-block:: sh\n\n pip install pytest-flake8dir\n\nPython 3.4+ supported.\n\nAPI\n===\n\n``flake8dir`` fixture\n---------------------\n\nA pytest fixture that wraps Pytest's built-in ``tmpdir`` fixture\n(`docs `_), to create a\ntemporary directory, allow adding files, and running flake8.\n\nIf you're using this to test a flake8 plugin, make sure flake8 is picking up\nyour plugin during tests. Normally this is done with a ``setup.py`` entrypoint,\nwhich makes ``tox`` the easiest way to guarantee this is ready as it will run\n``setup.py install`` on your project before running tests.\n\n``flake8dir.make_py_files(**kwargs: Mapping[str, str])``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nCreates one python file for each passed keyword argument, with name\ncorresponding to the keyword argument + '.py', and content according the string\nvalue of the argument. The value will be processed with ``textwrap.dedent()``\nso mixed indentation is not a problem in your test files.\n\nFor example, this creates two python files in the temporary directory, called\n``example1.py`` and ``example2.py``, each containing one line with an\nassignment:\n\n.. code-block:: python\n\n def test_sample(flake8dir):\n flake8dir.make_py_files(\n example1='''\n x = 1\n ''',\n example2='''\n y = 1\n '''\n )\n\n``flake8dir.make_example_py(content: str)``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA shortcut for ``make_py_files(example=content)``, for when you are using a\nsingle file over and over. This creates just ``example.py``, which is often\nall you need for testing a rule.\n\nFor example:\n\n.. code-block:: python\n\n def test_sample(flake8dir):\n flake8dir.make_example_py('''\n x = 1\n ''')\n\n``flake8dir.make_setup_cfg(contents: str)``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nMakes the file ``setup.cfg`` in the test directory with contents equal to the\nstring passed in. This is again processed with ``textwrap.dedent()`` so\nindentation is not a worry. You'll probably want to set the ``[flake8]``\nsection header to configure flake8.\n\nFor example, this makes flake8 ignore rule E101:\n\n.. code-block:: python\n\n def test_sample(flake8dir):\n flake8dir.make_setup_cfg('''\n [flake8]\n ignore = E101\n ''')\n\n``flake8dir.make_file(filename: str, content: str)``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nMake an arbitrary file with the given filename - this function is the inner\nimplementation for ``make_py_files`` and ``make_setup_cfg``. ``filename`` may\ninclude directories, like ``mydir/foo.py``, and they will be created.\n``content`` is subject to the same ``textwrap.dedent()`` processing as\nmentioned above.\n\nFor example:\n\n.. code-block:: python\n\n def test_sample(flake8dir):\n flake8dir.make_file('myfile/foo.py', '''\n x = 1\n ''')\n\n``flake8dir.run_flake8(extra_args: List[str]=None) -> Flake8Result``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nRuns flake8 in the current process, and returns a ``Flake8Result`` representing\nthe results.\n\n``extra_args`` may be a list of extra flags to pass to flake8, for example\npassing ``['--ignore', 'E101']`` would achieve the same thing as the above\n``setup.cfg`` example. Note some arguments are already passed to ensure it runs\nin the same process without multiprocessing - see source.\n\n\n``Flake8Result``\n----------------\n\nRepresents the parsed output of a flake8 run.\n\n``Flake8Result.out: str``\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe full string of output generated by flake8.\n\n``Flake8Result.exit_code: int``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe exit code that the flake8 run exited with.\n\n``Flake8Result.out_lines: List[str]``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA list of individual lines of output, without trailing newlines. This is the\nmost useful tool for making assertions against.\n\nFor example, given a result you can check for a particular line being output:\n\n.. code-block:: python\n\n result = flake8dir.run_flake8()\n expected = './example.py:1:2: E221 multiple spaces before operator'\n assert expected in result.out_lines\n\n.. _tmpdir: https://docs.pytest.org/en/latest/tmpdir.html\n\n\n\n\nHistory\n=======\n\nPending Release\n---------------\n\n.. Insert new release notes below this line\n\n2.1.0 (2019-04-10)\n------------------\n\n* Run ``flake8`` in a ``subprocess`` rather than trying to get a speed boost by\n running it in the current process. This is to overcome plugin state not\n resetting in-process in ``flake8`` 3.7.0+.\n\n2.0.0 (2019-02-28)\n------------------\n\n* Drop Python 2 support, only Python 3.4+ is supported now.\n\n1.3.0 (2018-10-16)\n------------------\n\n* A temporary ``setup.cfg`` file is now always created with no options and\n passed as ``--config``, to avoid flake8 merging in user-specific settings.\n Use ``make_setup_cfg`` to set the contents of this file.\n\n1.2.0 (2018-02-25)\n------------------\n\n* The exit code from ``flake8`` is now saved on the ``Flake8Result`` object.\n Any tests that relied on catching ``SystemExit`` themselves will need\n refactoring to use the new attribute for their assertions.\n\n1.1.0 (2017-06-23)\n------------------\n\n* Add convenience methods ``make_example_py`` and ``make_file``.\n\n1.0.0 (2017-06-22)\n------------------\n\n* First version with basic fixture supporting ``make_py_files``,\n ``make_setup_cfg`` and ``run_flake8``.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/adamchainz/pytest-flake8dir", "keywords": "pytest,flake8", "license": "ISC License", "maintainer": "", "maintainer_email": "", "name": "pytest-flake8dir", "package_url": "https://pypi.org/project/pytest-flake8dir/", "platform": "", "project_url": "https://pypi.org/project/pytest-flake8dir/", "project_urls": { "Homepage": "https://github.com/adamchainz/pytest-flake8dir" }, "release_url": "https://pypi.org/project/pytest-flake8dir/2.1.0/", "requires_dist": [ "flake8", "pytest" ], "requires_python": ">=3.4", "summary": "A pytest fixture for testing flake8 plugins.", "version": "2.1.0" }, "last_serial": 5138062, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "d30530cc78eecd17befb0841d2da8607", "sha256": "21f58f59b774eea4298ccc4c6d6b1e5a8b8320a21bdb60068b4c92eacb3a9b10" }, "downloads": -1, "filename": "pytest_flake8dir-1.0.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "d30530cc78eecd17befb0841d2da8607", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6641, "upload_time": "2017-06-22T21:20:57", "url": "https://files.pythonhosted.org/packages/36/45/25e88ee4720eb2b42a1528fba570fd3c90018159081327bbf021a216ba3d/pytest_flake8dir-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a7f721d7ca37c5ad81f9e32701e9e82", "sha256": "d9a3f563f8324e4db4c6d54df5f953d0883fbd059426e21d1760eb39ee6cf2ac" }, "downloads": -1, "filename": "pytest-flake8dir-1.0.0.tar.gz", "has_sig": true, "md5_digest": "6a7f721d7ca37c5ad81f9e32701e9e82", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5134, "upload_time": "2017-06-22T21:20:54", "url": "https://files.pythonhosted.org/packages/29/b1/e56da3d5afdef2fbfeb64c9d7c0e2eec2be7be18d36bab03c2a56d5bd96c/pytest-flake8dir-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "6c083b979a20947c9dac06aab2efc77c", "sha256": "ee10d3e987548dd72bc22c9f998d59b7354605473f13a37b131dfde825a7c95b" }, "downloads": -1, "filename": "pytest_flake8dir-1.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "6c083b979a20947c9dac06aab2efc77c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 7235, "upload_time": "2017-06-23T08:00:58", "url": "https://files.pythonhosted.org/packages/a0/8f/be886fdac420d40793b94759b2e32eddf12522d5e4f2e2c00db532f7cbd0/pytest_flake8dir-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d00b9384d6f59f5befdf4b4c9e2a25a7", "sha256": "bd4554ebbd3c9ef75be8a39438eb4d14e61bbe051e4acac48d0c72a3345296fa" }, "downloads": -1, "filename": "pytest-flake8dir-1.1.0.tar.gz", "has_sig": true, "md5_digest": "d00b9384d6f59f5befdf4b4c9e2a25a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5508, "upload_time": "2017-06-23T08:00:56", "url": "https://files.pythonhosted.org/packages/77/e2/7b6952938a61491987730b15f647187bd2533b247a8f6255a56f10a404ad/pytest-flake8dir-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "5aaabbfe45c5e0959467b7f9d9dbbf45", "sha256": "546d3f32984a2fa75f35e35855728e2fc28c2f12eda504c7982c92f3800f31a1" }, "downloads": -1, "filename": "pytest_flake8dir-1.2.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "5aaabbfe45c5e0959467b7f9d9dbbf45", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8656, "upload_time": "2018-02-25T21:20:31", "url": "https://files.pythonhosted.org/packages/78/22/ba3de544b1b02d07beab60cc5ab6566c61e11803fab382674f36160e46fa/pytest_flake8dir-1.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "126aa61c1aa737b2f6e646e22e816e68", "sha256": "85f4d303da1e466537db940571156f2e696cd7a6c86571a2fadc3e3690e0a99f" }, "downloads": -1, "filename": "pytest-flake8dir-1.2.0.tar.gz", "has_sig": true, "md5_digest": "126aa61c1aa737b2f6e646e22e816e68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6018, "upload_time": "2018-02-25T21:20:29", "url": "https://files.pythonhosted.org/packages/4c/52/a8d6308e24ac63b3fe29f6acb5b78de8e4f48f81c7f3269167ebb52bcd60/pytest-flake8dir-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "256eef4862329a71da44578381b25591", "sha256": "13803bc6738ed3a45972fa85365aa99fa011068ca48ab32006b87785bd60557f" }, "downloads": -1, "filename": "pytest_flake8dir-1.3.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "256eef4862329a71da44578381b25591", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 5703, "upload_time": "2018-10-16T08:38:14", "url": "https://files.pythonhosted.org/packages/d3/f9/1690b2ebd64bce35a56e5f66f3ad577ee4d061d1d9425b69e0b35c63b284/pytest_flake8dir-1.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1befc5c59b09d2274df867761da0d9b4", "sha256": "9ff1a8043ecfc4f155a8ad5367c01eefbad52f46856e91ece8c13e98e821e5f1" }, "downloads": -1, "filename": "pytest-flake8dir-1.3.0.tar.gz", "has_sig": true, "md5_digest": "1befc5c59b09d2274df867761da0d9b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6079, "upload_time": "2018-10-16T08:38:11", "url": "https://files.pythonhosted.org/packages/be/ea/d2317c324c45532f8c4b73e33f09c761a77a730a76e459238e455c6dd93f/pytest-flake8dir-1.3.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "ceda7967f4d11d5e4144165c50fd03d3", "sha256": "95f869b540ea887c0f58f3aa5affb4970cf9d90a0ede32a2a7100169c2a40d8b" }, "downloads": -1, "filename": "pytest_flake8dir-2.0.0-py3-none-any.whl", "has_sig": true, "md5_digest": "ceda7967f4d11d5e4144165c50fd03d3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 5614, "upload_time": "2019-02-28T05:47:58", "url": "https://files.pythonhosted.org/packages/00/ef/1b881e1a535197e996e666c2705177726e92f59f4dbf1893e8d5ed3b4328/pytest_flake8dir-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "84edd1f73ca99b6cad6dd9286c9e6baf", "sha256": "c6e7a5a3b670fc053327be9cf741aa1678d85d2dd82d7f7c0b6ea5a69c9d3a60" }, "downloads": -1, "filename": "pytest-flake8dir-2.0.0.tar.gz", "has_sig": true, "md5_digest": "84edd1f73ca99b6cad6dd9286c9e6baf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 6013, "upload_time": "2019-02-28T05:48:00", "url": "https://files.pythonhosted.org/packages/b9/33/79afcc2d8ce6e8dfdbd89c11c6cb15f4cf6c338faf6b82e92227f84788b0/pytest-flake8dir-2.0.0.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "9780683bbbabcc72eaff8638268e2ba8", "sha256": "d1251889a09fbcb8f19c2f9de34fbd3aa9121eeff8bce8d5a36758e5f317ef63" }, "downloads": -1, "filename": "pytest_flake8dir-2.1.0-py3-none-any.whl", "has_sig": true, "md5_digest": "9780683bbbabcc72eaff8638268e2ba8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 5315, "upload_time": "2019-04-13T13:14:33", "url": "https://files.pythonhosted.org/packages/9d/74/1e66624b15a17fd3bd8b5cbfec41f18dc65ba55e60f00e17e95187d1c993/pytest_flake8dir-2.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb1129d68cb6b6cdea65e51420849125", "sha256": "bbcecc3fc3a548532fa85efca4c7956fdce7ad3d5724f8a300be069b178491de" }, "downloads": -1, "filename": "pytest-flake8dir-2.1.0.tar.gz", "has_sig": true, "md5_digest": "eb1129d68cb6b6cdea65e51420849125", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 5768, "upload_time": "2019-04-13T13:14:35", "url": "https://files.pythonhosted.org/packages/49/1c/7bc2210d26ef70a1752a8961d25f8d90a58f2f3a1524cee1c7ab68acb3ee/pytest-flake8dir-2.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9780683bbbabcc72eaff8638268e2ba8", "sha256": "d1251889a09fbcb8f19c2f9de34fbd3aa9121eeff8bce8d5a36758e5f317ef63" }, "downloads": -1, "filename": "pytest_flake8dir-2.1.0-py3-none-any.whl", "has_sig": true, "md5_digest": "9780683bbbabcc72eaff8638268e2ba8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 5315, "upload_time": "2019-04-13T13:14:33", "url": "https://files.pythonhosted.org/packages/9d/74/1e66624b15a17fd3bd8b5cbfec41f18dc65ba55e60f00e17e95187d1c993/pytest_flake8dir-2.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb1129d68cb6b6cdea65e51420849125", "sha256": "bbcecc3fc3a548532fa85efca4c7956fdce7ad3d5724f8a300be069b178491de" }, "downloads": -1, "filename": "pytest-flake8dir-2.1.0.tar.gz", "has_sig": true, "md5_digest": "eb1129d68cb6b6cdea65e51420849125", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 5768, "upload_time": "2019-04-13T13:14:35", "url": "https://files.pythonhosted.org/packages/49/1c/7bc2210d26ef70a1752a8961d25f8d90a58f2f3a1524cee1c7ab68acb3ee/pytest-flake8dir-2.1.0.tar.gz" } ] }