diff options
-rw-r--r-- | .hgignore | 2 | ||||
-rw-r--r-- | .hgtags | 26 | ||||
-rw-r--r-- | .travis.yml | 13 | ||||
-rw-r--r-- | CHANGES.rst | 16 | ||||
-rw-r--r-- | README.rst | 32 | ||||
-rw-r--r-- | docs/conf.py | 29 | ||||
-rw-r--r-- | docs/requirements.txt | 1 | ||||
-rw-r--r-- | ptr.py | 25 | ||||
-rw-r--r-- | pytest.ini | 2 | ||||
-rw-r--r-- | setup.cfg | 4 | ||||
-rw-r--r-- | setup.py | 15 | ||||
-rw-r--r-- | tests/requirements.txt | 2 | ||||
-rw-r--r-- | tox.ini | 6 |
13 files changed, 97 insertions, 76 deletions
diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 31e77e9..0000000 --- a/.hgignore +++ /dev/null @@ -1,2 +0,0 @@ -build
-dist
diff --git a/.hgtags b/.hgtags deleted file mode 100644 index 762b7d1..0000000 --- a/.hgtags +++ /dev/null @@ -1,26 +0,0 @@ -a41b62bd27ddab9ce0dda1f586a91eaed1d6a28c 1.0a1 -329b93ea52567ef21c0e96bc78c7dce1d1091607 1.0a2 -9c26b0f31e3033de73e81d84c3140ad22c4c6e14 1.0b1 -b66744dba81a3d674d83420d56d7abfcd132f32a 1.0b2 -fc47a169b30fddce2e37259cf9f853b3fc58cf83 1.0 -5073ad862016aed2c9bd01c06105d505139f754a 1.1b1 -1a37e4e32c68807b5a84ce96244ac285336d0bff 1.1 -fff2c07f64587d73505cdcac4880ecd652f8b308 1.2 -2759a927af554bf3dc7a8feb79353b88bb3eec97 2.0 -339be8b7dc911dd3cd3e2095d7fe1de47fb6c956 2.1 -b4e3fd6cf0e3559f71dcecbf321dbc92723f3df5 2.1.1 -ad7ce5b4257c47bbfc6ff49271ef3a675deb156a 2.1.2 -b0c0ff130ab962a5eea998c91b077296952e4465 2.2 -cc63a4576386eaade57b16590fe7c0053f4533c2 2.2.1 -b71c2b4ed8f735500eabe3fabc5048a36a6a3420 2.3 -4d109575243f51425d03baa8c4bce8c989e87fec 2.4 -ae4193e3172955d2a4cd00208e1f392b6c3c1148 2.5 -fe07ae9c3f076ebf3b716e9951de5492314159df 2.5.1 -0304f39b40f791b81da8a14aed6e8910f798af14 2.6 -cce8431d8b4d9441740a723c7c700d810a4662f8 2.6.1 -0cc61470c2a2fd5b0ed2c4c4ac7480bf68526f6e 2.6.2 -daf0974a5e9348b8c8e20e9ee227702edc5b6e75 2.6.3 -a1fa887922d237f915ba51f9022f4da983ceb32e 2.7 -21cfa346c8960f29f1a364d97ecbb9d1a7f6a3c0 2.7.1 -955536a145d5db5e4a2c23bf52fd575fbc595196 2.8 -8a73cfa80d1bf4ada6e6e93559c99de1850e1ba9 2.9 diff --git a/.travis.yml b/.travis.yml index 22c86d4..03d4e22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,12 @@ sudo: false language: python python: - 2.7 -- 3.5 +- 3.6 +- nightly +install: +- pip install tox "setuptools>=28.2" script: -- pip install -U pytest -- python setup.py test +- tox branches: except: - skeleton @@ -15,8 +17,9 @@ deploy: on: tags: true all_branches: true - python: 3.5 + python: 3.6 user: jaraco - distributions: dist + distributions: dists + skip_upload_docs: true password: secure: lZfYQx0ZrCf2FJ+348etKWfzTySB3BZYGd0ce5RFHN2BppcdkONyJfTs4rgdrFEn/WtOaKV3SkJYR09xvlr+4kbLibg7fXhueqZt0ZkhRBnoDE4SxCjICyFCmisG6O3zkrVosizch70/0MqseNanhgXOPhd5llCfQHIqLsa145BG4hM5kxAHPO3Rz2/HCObOTPe4HKj93RAK7lPIMZVN6omcWoG6ZB0QqK+i3LTUtmJ3gE6q/iHk3VF9cJs8xtn3hdo++Lhrboa2NIqf6fl8oxR1C24Wh8vBQ69uTNjmVnDFYMulTs5475jjgDBXPPgVz3CAqYAy/PI+NPw59ebK8MzlaMRK/h/xSrdhxW6K3WbBL71Dn2UGuejXHFC3IuCI832xwkuEupOcGLWz4r2uBnhbgXF63vZ2gYPqrCGHxvDpbtllTVyEeebP8BnFzZttxSn9rbhTP1O9Dn/9tRko8WskyXIR+/2JOA9KP5uT47yeHoFBBUS0GB1XdkGhBrJfQx2LhfHuI6bpzosMiMfJrVNZEg8k0I9XA0uwxDgZrdqKGMKBR6233MXiJg8NyUPRInCRGth4rufcq6kn+wsT9RvuSt9XOhGiYLwChjvHexUXrLGBgupu0Y80Oqcp3YkDG3WHUX++Z2zJSQovrb4BMdKS6Y4usQ8Df5SklIpMCf0= diff --git a/CHANGES.rst b/CHANGES.rst index 27c189b..7e56ea9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,19 @@ +2.11.1 +~~~~~~ + +* #28: Fix logic in marker evaluation. + +2.11 +~~~~ + +* #27: Improved wording in the README around configuration + for the distutils command and pytest proper. + +2.10.1 +~~~~~~ + +* #21: Avoid mutating dictionary keys during iteration. + 2.10 ~~~~ @@ -11,6 +11,14 @@ Setup scripts can use pytest-runner to add setup.py test support for pytest runner. + +License +======= + +License is indicated in the project metadata (typically one or more +of the Trove classifiers). For more details, see `this explanation +<https://github.com/jaraco/skeleton/issues/1>`_. + Usage ----- @@ -21,14 +29,14 @@ Usage - Pass ``--index-url`` to have test requirements downloaded from an alternate index URL (unnecessary if specified for easy_install in setup.cfg). - 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/pytest-dev/pytest/issues/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. +- Set permanent options for the ``python setup.py pytest`` command (like ``index-url``) + in the ``[pytest]`` section of ``setup.cfg``. +- Set permanent options for the ``py.test`` run (like ``addopts`` or ``pep8ignore``) in the ``[pytest]`` + section of ``pytest.ini`` or ``tox.ini`` or put them in the ``[tool:pytest]`` + section of ``setup.cfg``. See `pytest issue 567 + <https://github.com/pytest-dev/pytest/issues/567>`_. +- Optionally, set ``test=pytest`` in the ``[aliases]`` section of ``setup.cfg`` + to cause ``python setup.py test`` to invoke pytest. Example ------- @@ -48,15 +56,15 @@ 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://github.com/jaraco/jaraco.collections>`_ project -for real-world usage. +Follow `this search on github +<https://github.com/search?utf8=%E2%9C%93&q=filename%3Asetup.py+pytest-runner&type=Code&ref=searchresults>`_ +for examples of real-world usage. Standalone Example ------------------ This technique is deprecated - if you have standalone scripts -you wish to invoke with dependincies, `use rwt +you wish to invoke with dependencies, `use rwt <https://pypi.org/project/rwt>`_. Although ``pytest-runner`` is typically used to add pytest test diff --git a/docs/conf.py b/docs/conf.py index ebc0453..e6af71f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,7 +1,12 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import setuptools_scm +import os +import sys +import subprocess + +if 'check_output' not in dir(subprocess): + import subprocess32 as subprocess extensions = [ 'sphinx.ext.autodoc', @@ -9,31 +14,41 @@ extensions = [ ] # General information about the project. -project = 'pytest-runner' -copyright = '2015,2016 Jason R. Coombs' -# The short X.Y version. -version = setuptools_scm.get_version(root='..', relative_to=__file__) +root = os.path.join(os.path.dirname(__file__), '..') +setup_script = os.path.join(root, 'setup.py') +fields = ['--name', '--version', '--url', '--author'] +dist_info_cmd = [sys.executable, setup_script] + fields +output_bytes = subprocess.check_output(dist_info_cmd, cwd=root) +project, version, url, author = output_bytes.decode('utf-8').strip().split('\n') + +copyright = '2015-2017 ' + author + # The full version, including alpha/beta/rc tags. release = version master_doc = 'index' link_files = { - 'CHANGES.rst': dict( + '../CHANGES.rst': dict( using=dict( GH='https://github.com', project=project, + url=url, ), replace=[ dict( pattern=r"(Issue )?#(?P<issue>\d+)", - url='{GH}/pytest-dev/{project}/issues/{issue}', + url='{url}/issues/{issue}', ), dict( pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n", with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n", ), + dict( + pattern=r"PEP[- ](?P<pep_number>\d+)", + url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/', + ), ], ), } diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..442df9f --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +rst.linker @@ -128,12 +128,11 @@ class PyTest(orig.test): except AttributeError: return null() - def run(self): - """ - Override run to ensure requirements are available in this session (but - don't install them anywhere). - """ - self._build_egg_fetcher() + def _super_run(self): + if hasattr(orig.test, 'install_dists'): + return orig.test.run(self) + + # for backward compatibility with setuptools < 27.3 installed_dists = self.install_dists(self.distribution) if self.dry_run: self.announce('skipping tests (dry run)') @@ -141,6 +140,14 @@ class PyTest(orig.test): paths = map(_operator.attrgetter('location'), installed_dists) with self.paths_on_pythonpath(paths): self.with_project_on_sys_path(self.run_tests) + + def run(self): + """ + Override run to ensure requirements are available in this session (but + don't install them anywhere). + """ + self._build_egg_fetcher() + self._super_run() if self.result_code: raise SystemExit(self.result_code) return self.result_code @@ -158,7 +165,7 @@ class PyTest(orig.test): 'find_links', 'site_dirs', 'index_url', 'optimize', 'site_dirs', 'allow_hosts' ) - for key in opts.keys(): + for key in list(opts.keys()): if key not in keep: del opts[key] # don't use any other settings if main_dist.dependency_links: @@ -180,6 +187,10 @@ class PyTest(orig.test): cmd.ensure_finalized() main_dist._egg_fetcher = cmd + @property + def _argv(self): + return ['pytest'] + self.addopts + def run_tests(self): """ Invoke pytest, replacing argv. @@ -1,4 +1,4 @@ [pytest] -norecursedirs=*.egg .eggs dist build +norecursedirs=dist build .tox addopts=--doctest-modules doctest_optionflags=ALLOW_UNICODE ELLIPSIS @@ -1,10 +1,6 @@ [aliases] release = dists upload dists = clean --all sdist bdist_wheel -test = pytest [wheel] universal = 1 - -[upload] -repository = https://upload.pypi.org/legacy/ @@ -3,22 +3,16 @@ # Project skeleton maintained at https://github.com/jaraco/skeleton import io -import sys import setuptools with io.open('README.rst', encoding='utf-8') as readme: long_description = readme.read() -needs_pytest = set(['pytest', 'test']).intersection(sys.argv) -pytest_runner = ['pytest_runner'] if needs_pytest else [] -needs_wheel = set(['release', 'bdist_wheel', 'dists']).intersection(sys.argv) -wheel = ['wheel'] if needs_wheel else [] - name = 'pytest-runner' description = 'Invoke py.test as distutils command with dependency resolution' -setup_params = dict( +params = dict( name=name, use_scm_version=True, author="Jason R. Coombs", @@ -33,10 +27,7 @@ setup_params = dict( extras_require={ }, setup_requires=[ - 'setuptools_scm>=1.9', - ] + pytest_runner + wheel, - tests_require=[ - 'pytest>=2.8', + 'setuptools_scm>=1.15.0', ], classifiers=[ "Development Status :: 5 - Production/Stable", @@ -55,4 +46,4 @@ setup_params = dict( }, ) if __name__ == '__main__': - setuptools.setup(**setup_params) + setuptools.setup(**params) diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..ab48405 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,2 @@ +pytest >= 2.8 +subprocess32; python_version=="2.6" @@ -0,0 +1,6 @@ +[testenv] +deps = + -rtests/requirements.txt + +commands = py.test {posargs} +usedevelop = True |