diff options
-rw-r--r-- | .hgignore | 2 | ||||
-rw-r--r-- | README.txt | 190 | ||||
-rw-r--r-- | docs/conf.py | 22 | ||||
-rw-r--r-- | docs/history.rst | 8 | ||||
-rw-r--r-- | docs/index.rst | 22 | ||||
-rw-r--r-- | pytest.ini | 3 | ||||
-rw-r--r-- | setup.cfg | 3 | ||||
-rw-r--r-- | setup.py | 87 |
8 files changed, 208 insertions, 129 deletions
diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..31e77e9 --- /dev/null +++ b/.hgignore @@ -0,0 +1,2 @@ +build
+dist
@@ -1,95 +1,95 @@ -pytest-runner -============= - -Setup scripts can use pytest-runner to add setup.py test support for pytest -runner. - -Usage ------ - -- Add 'pytest-runner' to your 'setup_requires'. Pin to '>=2.0,<3dev' (or - similar) to avoid pulling in incompatible versions. -- Include 'pytest' and any other testing requirements to 'tests_require'. -- Invoke tests with ``setup.py pytest``. -- Pass ``--index-url`` to have test requirements downloaded from an alternate - index URL. -- Pass additional py.test command-line options using ``--addopts``. -- Set permanent options for the pytest distutils command in the ``[pytest]`` - section of setup.cfg. -- Set permanent options for the pytest run itself in the ``[pytest]`` - section of pytest.ini or tox.ini. See `pytest 567 - <https://bitbucket.org/hpk42/pytest/issue/567>`_ for details on - why setup.cfg is inadequate. -- Optionally, set ``test=pytest`` in the ``[aliases]`` section of setup.cfg - to cause ``setup.py test`` to invoke pytest. - -Example -------- - -The most simple usage looks like this in setup.py:: - - setup( - setup_requires=[ - 'pytest-runner', - ], - tests_require=[ - 'pytest', - ], - ) - -Additional dependencies require to run the tests (e.g. mock or pytest -plugins) may be added to tests_require and will be downloaded and -required by the session before invoking pytest. - -See the `jaraco.collections -<https://bitbucket.org/jaraco/jaraco.collections/>`_ project -for real-world usage. - -Standalone Example ------------------- - -Although ``pytest-runner`` is typically used to add pytest test -runner support to maintained packages, ``pytest-runner`` may -also be used to create standalone tests. Consider `this example -failure <https://gist.github.com/jaraco/d979a558bc0bf2194c23>`_, -reported in `jsonpickle #117 -<https://github.com/jsonpickle/jsonpickle/issues/117>`_. - -That single file may be cloned or downloaded and simply run on -any system with Python and Setuptools. It will download the -specified dependencies and run the tests. Afterward, the the -cloned directory can be removed and with it all trace of -invoking the test. No other dependencies are needed and no -system configuration is altered. - -Then, anyone trying to replicate the failure can do so easily -and with all the power of pytest (rewritten assertions, -rich comparisons, interactive debugging, extensibility through -plugins, etc). - -As a result, the communication barrier for describing and -replicating failures is made almost trivially low. - -Considerations --------------- - -Conditional Requirement -~~~~~~~~~~~~~~~~~~~~~~~ - -Because it uses Setuptools setup_requires, pytest-runner will install itself -on every invocation of setup.py. In some cases, this causes delays for -invocations of setup.py that will never invoke pytest-runner. To help avoid -this contingency, consider requiring pytest-runner only when pytest -is invoked:: - - needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) - pytest_runner = ['pytest_runner'] if needs_pytest else [] - - # ... - - setup( - #... - setup_requires=[ - #... (other setup requirements) - ] + pytest_runner, - ) +pytest-runner
+=============
+
+Setup scripts can use pytest-runner to add setup.py test support for pytest
+runner.
+
+Usage
+-----
+
+- Add 'pytest-runner' to your 'setup_requires'. Pin to '>=2.0,<3dev' (or
+ similar) to avoid pulling in incompatible versions.
+- Include 'pytest' and any other testing requirements to 'tests_require'.
+- Invoke tests with ``setup.py pytest``.
+- Pass ``--index-url`` to have test requirements downloaded from an alternate
+ index URL.
+- Pass additional py.test command-line options using ``--addopts``.
+- Set permanent options for the pytest distutils command in the ``[pytest]``
+ section of setup.cfg.
+- Set permanent options for the pytest run itself in the ``[pytest]``
+ section of pytest.ini or tox.ini. See `pytest 567
+ <https://bitbucket.org/hpk42/pytest/issue/567>`_ for details on
+ why setup.cfg is inadequate.
+- Optionally, set ``test=pytest`` in the ``[aliases]`` section of setup.cfg
+ to cause ``setup.py test`` to invoke pytest.
+
+Example
+-------
+
+The most simple usage looks like this in setup.py::
+
+ setup(
+ setup_requires=[
+ 'pytest-runner',
+ ],
+ tests_require=[
+ 'pytest',
+ ],
+ )
+
+Additional dependencies require to run the tests (e.g. mock or pytest
+plugins) may be added to tests_require and will be downloaded and
+required by the session before invoking pytest.
+
+See the `jaraco.collections
+<https://bitbucket.org/jaraco/jaraco.collections/>`_ project
+for real-world usage.
+
+Standalone Example
+------------------
+
+Although ``pytest-runner`` is typically used to add pytest test
+runner support to maintained packages, ``pytest-runner`` may
+also be used to create standalone tests. Consider `this example
+failure <https://gist.github.com/jaraco/d979a558bc0bf2194c23>`_,
+reported in `jsonpickle #117
+<https://github.com/jsonpickle/jsonpickle/issues/117>`_.
+
+That single file may be cloned or downloaded and simply run on
+any system with Python and Setuptools. It will download the
+specified dependencies and run the tests. Afterward, the the
+cloned directory can be removed and with it all trace of
+invoking the test. No other dependencies are needed and no
+system configuration is altered.
+
+Then, anyone trying to replicate the failure can do so easily
+and with all the power of pytest (rewritten assertions,
+rich comparisons, interactive debugging, extensibility through
+plugins, etc).
+
+As a result, the communication barrier for describing and
+replicating failures is made almost trivially low.
+
+Considerations
+--------------
+
+Conditional Requirement
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Because it uses Setuptools setup_requires, pytest-runner will install itself
+on every invocation of setup.py. In some cases, this causes delays for
+invocations of setup.py that will never invoke pytest-runner. To help avoid
+this contingency, consider requiring pytest-runner only when pytest
+is invoked::
+
+ needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
+ pytest_runner = ['pytest_runner'] if needs_pytest else []
+
+ # ...
+
+ setup(
+ #...
+ setup_requires=[
+ #... (other setup requirements)
+ ] + pytest_runner,
+ )
diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..12d03c6 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import hgtools.managers
+
+# use hgtools to get the version
+hg_mgr = hgtools.managers.RepoManager.get_first_valid_manager()
+
+extensions = [
+ 'sphinx.ext.autodoc',
+]
+
+# General information about the project.
+project = 'pytest-runner'
+copyright = '2015 Jason R. Coombs'
+
+# The short X.Y version.
+version = hg_mgr.get_current_version()
+# The full version, including alpha/beta/rc tags.
+release = version
+
+master_doc = 'index'
diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 0000000..db85fec --- /dev/null +++ b/docs/history.rst @@ -0,0 +1,8 @@ +:tocdepth: 2
+
+.. _changes:
+
+History
+*******
+
+.. include:: ../CHANGES.txt
diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..6b8d791 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,22 @@ +Welcome to pytest-runner documentation!
+========================================
+
+.. toctree::
+ :maxdepth: 1
+
+ history
+
+
+.. automodule:: pytest-runner
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..f38e724 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest]
+norecursedirs=*.egg .eggs dist build
+addopts=--doctest-modules
diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..e3b1c8b --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[aliases]
+release = sdist build_sphinx upload upload_docs
+test = pytest
@@ -1,34 +1,53 @@ -#!/usr/bin/env python -# Generated by jaraco.develop (https://bitbucket.org/jaraco/jaraco.develop) -import setuptools - -setup_params = dict( - name='pytest-runner', - get_version_from_scm=True, - author="Jason R. Coombs", - author_email="jaraco@jaraco.com", - url="https://bitbucket.org/jaraco/pytest-runner", - description="Invoke py.test as distutils command with dependency " - "resolution.", - py_modules = ['ptr'], - zip_safe=True, - entry_points = { - 'distutils.commands': [ - 'ptr = ptr:PyTest', - 'pytest = ptr:PyTest', - ], - }, - license = 'MIT', - classifiers = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Programming Language :: Python :: 2.6", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - ], - setup_requires=[ - 'hgdistver', - ], -) -if __name__ == '__main__': - setuptools.setup(**setup_params) +#!/usr/bin/env python
+# Generated by jaraco.develop 2.14
+# https://pypi.python.org/pypi/jaraco.develop
+
+import io
+import sys
+
+import setuptools
+
+with io.open('README.txt', encoding='utf-8') as readme:
+ long_description = readme.read()
+
+needs_pytest = {'pytest', 'test'}.intersection(sys.argv)
+pytest_runner = ['pytest_runner'] if needs_pytest else []
+needs_sphinx = {'release', 'build_sphinx', 'upload_docs'}.intersection(sys.argv)
+sphinx = ['sphinx'] if needs_sphinx else []
+
+setup_params = dict(
+ name='pytest-runner',
+ use_scm_version=True,
+ author="Jason R. Coombs",
+ author_email="jaraco@jaraco.com",
+ description="Invoke py.test as distutils command with dependency "
+ "resolution.",
+ long_description=long_description,
+ url="https://bitbucket.org/jaraco/pytest-runner",
+ py_modules=['ptr'],
+ entry_points = {
+ 'distutils.commands': [
+ 'ptr = ptr:PyTest',
+ 'pytest = ptr:PyTest',
+ ],
+ },
+ install_requires=[
+ ],
+ setup_requires=[
+ 'setuptools_scm',
+ ] + pytest_runner + sphinx,
+ tests_require=[
+ 'pytest',
+ ],
+ license='MIT',
+ classifiers=[
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Programming Language :: Python :: 2.6",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3",
+ ],
+)
+if __name__ == '__main__':
+ setuptools.setup(**setup_params)
|