From 469bdcec5ea94daf99fef2957dd31f2736613419 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Fri, 29 Jan 2021 11:07:07 -0500 Subject: [PATCH 01/20] Start branch for 0.15.5 --- CHANGELOG.md | 5 ++++- xdoctest/__init__.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b538bea0..8b6450cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,10 @@ We are currently working on porting this changelog to the specifications in This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Version 0.15.4 - Unreleased +## Version 0.15.5 - Unreleased + + +## Version 0.15.4 - Released 2021-01-29 ### Fixed * Minor issues with release tarballs. diff --git a/xdoctest/__init__.py b/xdoctest/__init__.py index 5530b844..38a78837 100644 --- a/xdoctest/__init__.py +++ b/xdoctest/__init__.py @@ -282,7 +282,7 @@ def fib(n): mkinit xdoctest --nomods ''' -__version__ = '0.15.4' +__version__ = '0.15.5' # Expose only select submodules From d8e1019c81c749dd0a7195599857cf5adca40308 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Fri, 29 Jan 2021 11:07:38 -0500 Subject: [PATCH 02/20] Fix 3.10 tag --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 27c209a3..b5ef80e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -211,7 +211,7 @@ workflows: version: 2 test: jobs: - - test_full/cp310-310-linux + - test_full/cp3_10-3_10-linux - test_full/cp39-39-linux - test_full/cp38-38-linux - test_full/cp37-37m-linux @@ -220,7 +220,7 @@ workflows: - test_full/cp34-34m-linux - test_full/cp27-27mu-linux - - test_minimal/cp310-310-linux + - test_minimal/cp3_10-3_10-linux - test_minimal/cp39-39-linux - test_minimal/cp38-38-linux - test_minimal/cp37-37m-linux @@ -431,7 +431,7 @@ jobs: # All we need to do is change the base docker image so python is the # version we want we can reuse everything else from the template # - test_full/cp310-310-linux: + test_full/cp3_10-3_10-linux: <<: *test_full_template docker: - image: circleci/python:3.10-rc @@ -472,7 +472,7 @@ jobs: - image: circleci/python:2.7 # ------------ - test_minimal/cp310-310-linux: + test_minimal/cp3_10-3_10-linux: <<: *test_minimal_template docker: - image: circleci/python:3.10-rc From a2d14b7ef258b4651dba6e546ba649c34c203b84 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Fri, 29 Jan 2021 11:21:23 -0500 Subject: [PATCH 03/20] Fix push token environ --- .circleci/config.yml | 101 ++++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 31 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5ef80e6..6b62cb82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -211,38 +211,75 @@ workflows: version: 2 test: jobs: - - test_full/cp3_10-3_10-linux - - test_full/cp39-39-linux - - test_full/cp38-38-linux - - test_full/cp37-37m-linux - - test_full/cp36-36m-linux - - test_full/cp35-35m-linux - - test_full/cp34-34m-linux - - test_full/cp27-27mu-linux - - - test_minimal/cp3_10-3_10-linux - - test_minimal/cp39-39-linux - - test_minimal/cp38-38-linux - - test_minimal/cp37-37m-linux - - test_minimal/cp36-36m-linux - - test_minimal/cp35-35m-linux - - test_minimal/cp34-34m-linux - - test_minimal/cp27-27mu-linux - - - test_minimal/pypy3 - - test_full/pypy3 - - - test_full/pypy3 - - gpgsign/cp38-38-linux - - #- gpgsign/cp38-38-linux: - # filters: - # branches: - # only: - # - master - # - release + - test_full/cp3_10-3_10-linux: + filters: &__ignore_release__ # this yaml anchor to ignore tests on the release branch + branches: + ignore: + - release + - test_full/cp39-39-linux: + filters: + <<: *__ignore_release__ + - test_full/cp38-38-linux: + filters: + <<: *__ignore_release__ + - test_full/cp37-37m-linux: + filters: + <<: *__ignore_release__ + - test_full/cp36-36m-linux: + filters: + <<: *__ignore_release__ + - test_full/cp35-35m-linux: + filters: + <<: *__ignore_release__ + - test_full/cp34-34m-linux: + filters: + <<: *__ignore_release__ + - test_full/cp27-27mu-linux: + filters: + <<: *__ignore_release__ + + - test_minimal/cp3_10-3_10-linux: + filters: + <<: *__ignore_release__ + - test_minimal/cp39-39-linux: + filters: + <<: *__ignore_release__ + - test_minimal/cp38-38-linux: + filters: + <<: *__ignore_release__ + - test_minimal/cp37-37m-linux: + filters: + <<: *__ignore_release__ + - test_minimal/cp36-36m-linux: + filters: + <<: *__ignore_release__ + - test_minimal/cp35-35m-linux: + filters: + <<: *__ignore_release__ + - test_minimal/cp34-34m-linux: + filters: + <<: *__ignore_release__ + - test_minimal/cp27-27mu-linux: + filters: + <<: *__ignore_release__ + + - test_minimal/pypy3: + filters: + <<: *__ignore_release__ + - test_full/pypy3: + filters: + <<: *__ignore_release__ + + - gpgsign/cp38-38-linux: + filters: + branches: + only: + - master + - release - deploy/cp38-38-linux: + requires: + - gpgsign/cp38-38-linux filters: branches: only: @@ -260,6 +297,8 @@ jobs: - PYTHON_EXE: python docker: - image: circleci/python + # We shouldnt need a lot of resources to run + resource_class: small steps: - checkout #working_directory: ~/{{ .Environment.CIRCLE_JOB }} @@ -417,7 +456,7 @@ jobs: echo "Tag already exists" else git tag $VERSION -m "tarball tag $VERSION" - git push --tags "https://${GIT_PUSH_TOKEN}@${URL_HOST}" + git push --tags "https://${GITHUB_PUSH_TOKEN}@${URL_HOST}" fi From b405ee820681ef13727354f12163dd483bd7ec37 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Fri, 29 Jan 2021 11:55:07 -0500 Subject: [PATCH 04/20] remove ubelt references --- xdoctest/docstr/convert_google_to_numpy.py | 70 +++++++++++++++++++--- xdoctest/parser.py | 2 +- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/xdoctest/docstr/convert_google_to_numpy.py b/xdoctest/docstr/convert_google_to_numpy.py index 7acf21fd..924913c1 100644 --- a/xdoctest/docstr/convert_google_to_numpy.py +++ b/xdoctest/docstr/convert_google_to_numpy.py @@ -1,10 +1,62 @@ +def argsort(indexable, key=None, reverse=False): + """ + Returns the indices that would sort a indexable object. + + This is similar to :func:`numpy.argsort`, but it is written in pure python + and works on both lists and dictionaries. + + Args: + indexable (Iterable[B] | Mapping[A, B]): indexable to sort by + + key (Callable[[A], B], default=None): + customizes the ordering of the indexable + + reverse (bool, default=False): if True returns in descending order + + Returns: + List[int]: indices - list of indices such that sorts the indexable + + Example: + >>> # argsort works on dicts by returning keys + >>> dict_ = {'a': 3, 'b': 2, 'c': 100} + >>> indices = argsort(dict_) + >>> # argsort works on lists by returning indices + >>> indexable = [100, 2, 432, 10] + >>> indices = argsort(indexable) + >>> # Can use iterators, but be careful. It exhausts them. + >>> indexable = reversed(range(100)) + >>> indices = argsort(indexable) + >>> assert indices[0] == 99 + >>> # Can use key just like sorted + >>> indexable = [[0, 1, 2], [3, 4], [5]] + >>> indices = argsort(indexable, key=len) + >>> # Can use reverse just like sorted + >>> indexable = [0, 2, 1] + >>> indices = argsort(indexable, reverse=True) + """ + try: + from collections import abc as collections_abc + except Exception: # nocover + import collections as collections_abc + # Create an iterator of value/key pairs + if isinstance(indexable, collections_abc.Mapping): + vk_iter = ((v, k) for k, v in indexable.items()) + else: + vk_iter = ((v, k) for k, v in enumerate(indexable)) + # Sort by values and extract the indices + if key is None: + indices = [k for v, k in sorted(vk_iter, reverse=reverse)] + else: + # If key is provided, call it using the value as input + indices = [k for v, k in sorted(vk_iter, key=lambda vk: key(vk[0]), + reverse=reverse)] + return indices def convert_file_docstrings(path_to_convert, dry=True): """ path_to_convert = ub.expandpath('~/code/networkx/networkx/algorithms/isomorphism/_embeddinghelpers/balanced_sequence.py') """ - import ubelt as ub from xdoctest.core import package_calldefs pkg_calldefs = list(package_calldefs(path_to_convert)) def recnone(val, default): @@ -12,9 +64,10 @@ def recnone(val, default): for calldefs, modpath in pkg_calldefs: to_insert = [] - old_text = ub.readfrom(modpath) + with open(modpath, 'r') as file: + old_text = file.read() old_lines = old_text.split('\n') - sortnames = ub.argsort(calldefs, key=lambda node: recnone(node.doclineno, -1)) + sortnames = argsort(calldefs, key=lambda node: recnone(node.doclineno, -1)) for name in sortnames: node = calldefs[name] if node.docstr is not None: @@ -30,7 +83,7 @@ def recnone(val, default): new_lines = old_lines.copy() for start, stop, body_lines in to_insert: old_middle = old_lines[start - 1:stop] - print('old_middle = {}'.format(ub.repr2(old_middle, nl=1))) + print('old_middle = {}'.format(old_middle)) print('start = {!r}'.format(start)) startline = new_lines[start - 1] print('startline = {!r}'.format(startline)) @@ -54,7 +107,8 @@ def recnone(val, default): print(xdev.misc.difftext(old_text, new_text, context_lines=10, colored=True)) print('^^^ modpath = {!r}'.format(modpath)) else: - ub.writeto(modpath, new_text, verbose=3) + with open(modpath, 'w') as file: + file.write(new_text) def google_to_numpy_docstr(docstr): @@ -68,7 +122,7 @@ def google_to_numpy_docstr(docstr): Returns: str: numpy style docstring """ - import ubelt as ub + from xdoctest.utils.util_str import indent as indent_fn from xdoctest.docstr import docscrape_google docblocks = docscrape_google.split_google_docblocks(docstr) new_parts = [] @@ -86,7 +140,7 @@ def google_to_numpy_docstr(docstr): docscrape_google.parse_google_argblock(old_body)) parts = [] for info in arginfos: - info['desc'] = ub.indent(info['desc']) + info['desc'] = indent_fn(info['desc']) p = '{name}: {type}\n{desc}'.format(**info) parts.append(p) parts.append('') @@ -96,7 +150,7 @@ def google_to_numpy_docstr(docstr): docscrape_google.parse_google_retblock(old_body)) parts = [] for info in retinfos: - info['desc'] = ub.indent(info['desc']) + info['desc'] = indent_fn(info['desc']) info['name'] = info.get('name', '') parts.append('{name}: {type}\n{desc}'.format(**info)) parts.append('') diff --git a/xdoctest/parser.py b/xdoctest/parser.py index fe2e474e..7f98f525 100644 --- a/xdoctest/parser.py +++ b/xdoctest/parser.py @@ -143,7 +143,7 @@ def parse(self, string, info=None): # If all lines begin with the same indentation, then strip it. min_indent = _min_indentation(string) if min_indent > 0: - string = '\n'.join([l[min_indent:] for l in string.splitlines()]) + string = '\n'.join([ln[min_indent:] for ln in string.splitlines()]) labeled_lines = None grouped_lines = None From f10cb2ec9497151476e6965ca3c681768972e1a3 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Wed, 24 Mar 2021 19:30:22 -0400 Subject: [PATCH 05/20] Made installing python doc more secure --- .circleci/config.yml | 2 +- docs/source/installing_python.rst | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b62cb82..e9dd67ff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -211,7 +211,7 @@ workflows: version: 2 test: jobs: - - test_full/cp3_10-3_10-linux: + - test_full/cp3_10-3_10-linux: filters: &__ignore_release__ # this yaml anchor to ignore tests on the release branch branches: ignore: diff --git a/docs/source/installing_python.rst b/docs/source/installing_python.rst index 1106fac4..4291b08f 100644 --- a/docs/source/installing_python.rst +++ b/docs/source/installing_python.rst @@ -15,9 +15,19 @@ creating, and activating a virtual environment. # Download the conda install script into a temporary directory mkdir -p ~/tmp cd ~/tmp - CONDA_INSTALL_SCRIPT=Miniconda3-latest-Linux-x86_64.sh + + # To update to a newer version see: + # https://docs.conda.io/en/latest/miniconda_hashes.html for updating + CONDA_INSTALL_SCRIPT=Miniconda3-py38_4.9.2-Linux-x86_64.sh + CONDA_EXPECTED_SHA256=1314b90489f154602fd794accfc90446111514a5a72fe1f71ab83e07de9504a7 curl https://repo.anaconda.com/miniconda/$CONDA_INSTALL_SCRIPT > $CONDA_INSTALL_SCRIPT - chmod +x $CONDA_INSTALL_SCRIPT + CONDA_GOT_SHA256=$(sha256sum $CONDA_INSTALL_SCRIPT | cut -d' ' -f1) + # For security, it is important to verify the hash + if [[ "$CONDA_GOT_SHA256" != "$CONDA_EXPECTED_SHA256_HASH" ]]; then + echo "Downloaded file does not match hash! DO NOT CONTINUE!" + exit 1; + fi + chmod +x $CONDA_INSTALL_SCRIPT # Install miniconda to user local directory _CONDA_ROOT=$HOME/.local/conda @@ -29,8 +39,7 @@ creating, and activating a virtual environment. conda create --name py38 python=3.8 --yes # Activate your vitualenv - # I recommend adding the following steps to your ~/.bashrc - _CONDA_ROOT=$HOME/.local/conda + # I recommend doing something similar in your ~/.bashrc source $_CONDA_ROOT/etc/profile.d/conda.sh conda activate py38 @@ -54,5 +63,4 @@ For other operating systems, see the official documentation to install conda `on Windows `_ or `on MacOS `_. - Once conda is installed the commands for `managing conda virtual environments `_ are roughly the same across platforms. From d84e91722f2f9d38147d6e28de7f2f703c431bc0 Mon Sep 17 00:00:00 2001 From: CircleCI Date: Fri, 2 Apr 2021 23:58:38 -0400 Subject: [PATCH 06/20] Fix Fixture Request warning --- .circleci/config.yml | 2 +- CHANGELOG.md | 3 +++ pytest.ini | 2 +- xdoctest/plugin.py | 6 +++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e9dd67ff..8315335c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -386,7 +386,7 @@ jobs: steps: - checkout - run: - name: build_gpg_deps + name: gpg_sign_dist command: | $PYTHON_EXE -m venv venv || virtualenv -v venv # first command is python3 || second is python2 . venv/bin/activate diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b6450cb..d91cbb9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Version 0.15.5 - Unreleased +### Fixed +* Fixed warning about using internal `FixtureRequest` + ## Version 0.15.4 - Released 2021-01-29 diff --git a/pytest.ini b/pytest.ini index 216737dd..ed5ece45 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,7 +1,7 @@ [pytest] # ON COVERAGE OF PYTEST PLUGINS: # http://pytest-cov.readthedocs.io/en/latest/plugins.html -addopts = -p pytester -p no:doctest --xdoctest --ignore-glob=setup.py --ignore=.tox +addopts = -p pytester -p no:doctest --xdoctest --ignore-glob=setup.py --ignore=.tox --ignore=setup.py --ignore=dev norecursedirs = .git ignore build __pycache__ docs *.egg-info _* dev testing/pybind11_test setup.py # --pyargs --doctest-modules --ignore=.tox ;rsyncdirs = tox.ini pytest.py _pytest testing diff --git a/xdoctest/plugin.py b/xdoctest/plugin.py index 9bdea1df..fab662ce 100644 --- a/xdoctest/plugin.py +++ b/xdoctest/plugin.py @@ -278,7 +278,11 @@ def func(): fm = xdoctest_item.session._fixturemanager xdoctest_item._fixtureinfo = fm.getfixtureinfo( node=xdoctest_item, func=func, cls=None, funcargs=False) - fixture_request = fixtures.FixtureRequest(xdoctest_item) + # Note: FixtureRequest may change in the future, we are using + # private functionality. Hopefully it wont break, but we should + # check to see if there is a better way to do this + # https://github.com/pytest-dev/pytest/discussions/8512#discussioncomment-563347 + fixture_request = fixtures.FixtureRequest(xdoctest_item, _ispytest=True) fixture_request._fillfixtures() return fixture_request From c54d98f18205706f34b93a58875c4fe4eceea735 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 10 May 2021 10:15:50 -0400 Subject: [PATCH 07/20] Fix for pytest warnings --- xdoctest/plugin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xdoctest/plugin.py b/xdoctest/plugin.py index fab662ce..83ad87ef 100644 --- a/xdoctest/plugin.py +++ b/xdoctest/plugin.py @@ -19,6 +19,7 @@ import pytest from _pytest._code import code from _pytest import fixtures +from distutils.version import LooseVersion # import traceback @@ -267,6 +268,9 @@ def collect(self): yield XDoctestItem(name, self, example) +_PYTEST_IS_GE_361 = LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') + + def _setup_fixtures(xdoctest_item): """ Used by XDoctestTextfile and XDoctestItem to setup fixture information. @@ -282,7 +286,11 @@ def func(): # private functionality. Hopefully it wont break, but we should # check to see if there is a better way to do this # https://github.com/pytest-dev/pytest/discussions/8512#discussioncomment-563347 - fixture_request = fixtures.FixtureRequest(xdoctest_item, _ispytest=True) + if _PYTEST_IS_GE_361: + # The "_ispytest" arg was added in 3.6.1 + fixture_request = fixtures.FixtureRequest(xdoctest_item, _ispytest=True) + else: + fixture_request = fixtures.FixtureRequest(xdoctest_item) fixture_request._fillfixtures() return fixture_request From 755eaf2cbe6f85e401ea098afe93b09597839fb9 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 10 May 2021 10:48:18 -0400 Subject: [PATCH 08/20] Update pytest plugin and tests --- CHANGELOG.md | 5 ++++- testing/test_binary_ext.py | 2 +- xdoctest/doctest_example.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d91cbb9c..95f306ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Version 0.15.5 - Unreleased +### Changed +* Better message when a pytest skip or exit-test-exception occurs + ### Fixed -* Fixed warning about using internal `FixtureRequest` +* Suppressed warning about using internal `FixtureRequest` ## Version 0.15.4 - Released 2021-01-29 diff --git a/testing/test_binary_ext.py b/testing/test_binary_ext.py index 2ce0bad5..443702bd 100644 --- a/testing/test_binary_ext.py +++ b/testing/test_binary_ext.py @@ -149,7 +149,7 @@ def build_demo_extmod(): else: try: from pip.__main__ import _main as pip_main - except AttributeError: + except (AttributeError, ImportError): from pip._internal import main as pip_main if callable(pip_main): diff --git a/xdoctest/doctest_example.py b/xdoctest/doctest_example.py index 0703636d..79957fba 100644 --- a/xdoctest/doctest_example.py +++ b/xdoctest/doctest_example.py @@ -637,9 +637,9 @@ def run(self, verbose=None, on_error=None): except KeyboardInterrupt: # nocover raise except (exceptions.ExitTestException, - exceptions._pytest.outcomes.Skipped): + exceptions._pytest.outcomes.Skipped) as ex: if verbose > 0: - print('Test gracefully exists') + print('Test gracefully exists on: ex={}'.format(ex)) break except checker.GotWantException: # When the "got", does't match the "want" From cf0d1b89aac398409525349dcf2c6ce87a81b51f Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 10 May 2021 11:54:48 -0400 Subject: [PATCH 09/20] wip --- requirements/tests.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 4a0be660..0df710ee 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,4 +1,6 @@ -pytest >= 3.3.1 +pytest >= 3.3.1 ; python_version > '3.6' +pytest >= 3.3.1 < 4.0.0 ; python_version <= '3.6' + # Tested with pytest versions: # 5.4.3 From 34c389d69f6aea3c8f0ecbee24c6067ebe81ed57 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 10 May 2021 12:06:59 -0400 Subject: [PATCH 10/20] fix requirement file --- requirements/tests.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 0df710ee..4c457ccb 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,5 +1,9 @@ pytest >= 3.3.1 ; python_version > '3.6' -pytest >= 3.3.1 < 4.0.0 ; python_version <= '3.6' + +# Pin maximum pytest versions for older python versions +pytest >= 3.3.1, <= 6.2.0 ; python_version < '3.7' and python_version >= '3.6' +pytest >= 3.3.1, <= 5.0.0 ; python_version < '3.6' and python_version >= '3.5' +pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5' # Tested with pytest versions: # 5.4.3 From 169ea12195592ef5001f7e701cf1969d4d6269d9 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 10 May 2021 12:13:42 -0400 Subject: [PATCH 11/20] ci tests --- requirements/tests.txt | 13 ++++++++++--- xdoctest/plugin.py | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 4c457ccb..7c0fb8d7 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,3 +1,6 @@ +# Tested with pytest versions: +# 5.4.3 + pytest >= 3.3.1 ; python_version > '3.6' # Pin maximum pytest versions for older python versions @@ -5,10 +8,14 @@ pytest >= 3.3.1, <= 6.2.0 ; python_version < '3.7' and python_version >= '3.6' pytest >= 3.3.1, <= 5.0.0 ; python_version < '3.6' and python_version >= '3.5' pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5' -# Tested with pytest versions: -# 5.4.3 +typing >= 3.7.4;python_version <= '3.4' + + +## + +pytest-cov < 2.6.0 ; python_version < '3.5' + -pytest-cov codecov >= 2.0.15 # For testing doctests in binary extension modules diff --git a/xdoctest/plugin.py b/xdoctest/plugin.py index 83ad87ef..2cc49016 100644 --- a/xdoctest/plugin.py +++ b/xdoctest/plugin.py @@ -268,7 +268,9 @@ def collect(self): yield XDoctestItem(name, self, example) -_PYTEST_IS_GE_361 = LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') +# _PYTEST_IS_GE_361 = LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') +_PYTEST_IS_GE_361 = 0 +# LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') def _setup_fixtures(xdoctest_item): From 76e21a527d25ee3c4605b5a35ac22897ebd51a81 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 10 May 2021 12:21:54 -0400 Subject: [PATCH 12/20] wip --- requirements/tests.txt | 1 + run_tests.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 7c0fb8d7..320ea454 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -13,6 +13,7 @@ typing >= 3.7.4;python_version <= '3.4' ## +pytest-cov > 2.6.0 ; python_version >= '3.6' pytest-cov < 2.6.0 ; python_version < '3.5' diff --git a/run_tests.py b/run_tests.py index 041256d3..f413ee8e 100755 --- a/run_tests.py +++ b/run_tests.py @@ -7,12 +7,16 @@ pytest_args = [ '-p', 'pytester', '-p', 'no:doctest', + '--xdoctest', '--cov-config', '.coveragerc', '--cov-report', 'html', '--cov-report', 'term', - '--xdoctest', '--cov=' + package_name, package_name, 'testing' ] pytest_args = pytest_args + sys.argv[1:] - sys.exit(pytest.main(pytest_args)) + print('pytest.__version__ = {!r}'.format(pytest.__version__)) + print('pytest_args = {!r}'.format(pytest_args)) + ret = pytest.main(pytest_args) + print('ret = {!r}'.format(ret)) + sys.exit(ret) From c854b083f4cd4c438b08513d31e07c266a6147bb Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 10 May 2021 12:52:35 -0400 Subject: [PATCH 13/20] wip --- requirements/tests.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 320ea454..717a8adf 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -4,17 +4,17 @@ pytest >= 3.3.1 ; python_version > '3.6' # Pin maximum pytest versions for older python versions -pytest >= 3.3.1, <= 6.2.0 ; python_version < '3.7' and python_version >= '3.6' -pytest >= 3.3.1, <= 5.0.0 ; python_version < '3.6' and python_version >= '3.5' -pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5' +pytest >= 3.3.1, <= 6.2.0 ; python_version < '3.7.0' and python_version >= '3.6.0' +pytest >= 3.3.1, <= 5.0.0 ; python_version < '3.6.0' and python_version >= '3.5.0' +pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5.0' typing >= 3.7.4;python_version <= '3.4' ## -pytest-cov > 2.6.0 ; python_version >= '3.6' -pytest-cov < 2.6.0 ; python_version < '3.5' +pytest-cov > 2.6.0 ; python_version >= '3.6.0' +pytest-cov < 2.6.0 ; python_version < '3.5.0' codecov >= 2.0.15 From 21aed84b34ca30f767a547feef2b7cfe8bd956cd Mon Sep 17 00:00:00 2001 From: joncrall Date: Wed, 12 May 2021 11:06:42 -0400 Subject: [PATCH 14/20] wip --- xdoctest/plugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xdoctest/plugin.py b/xdoctest/plugin.py index 2cc49016..50ef1a1f 100644 --- a/xdoctest/plugin.py +++ b/xdoctest/plugin.py @@ -268,9 +268,8 @@ def collect(self): yield XDoctestItem(name, self, example) -# _PYTEST_IS_GE_361 = LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') +_PYTEST_IS_GE_361 = LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') _PYTEST_IS_GE_361 = 0 -# LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') def _setup_fixtures(xdoctest_item): From a9abf77d421996d303a99b652970df9d038d1106 Mon Sep 17 00:00:00 2001 From: joncrall Date: Wed, 26 May 2021 21:54:13 -0400 Subject: [PATCH 15/20] wip --- xdoctest/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xdoctest/__main__.py b/xdoctest/__main__.py index df3c1152..1a047414 100644 --- a/xdoctest/__main__.py +++ b/xdoctest/__main__.py @@ -32,12 +32,12 @@ def main(argv=None): argv = sys.argv version_info = { - 'xdoc_version': xdoctest.__version__, + 'version': xdoctest.__version__, 'sys_version': sys.version, } if '--version' in argv: - print(version_info['xdoc_version']) + print(version_info['version']) return 0 if '--version-info' in argv: @@ -54,7 +54,7 @@ class RawDescriptionDefaultsHelpFormatter( parser = argparse.ArgumentParser( prog='xdoctest', description=( - 'Xdoctest {xdoc_version} - on Python - {sys_version} - ' + 'Xdoctest {version} - on Python - {sys_version} - ' 'discover and run doctests within a python package' ).format(**version_info), formatter_class=RawDescriptionDefaultsHelpFormatter, From 2fb13530020be85855979eeda06d216ad6c38300 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sat, 26 Jun 2021 13:59:11 -0400 Subject: [PATCH 16/20] Update pytest in requirements --- appveyor.yml | 2 +- requirements/tests.txt | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4cf09d31..344be18a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -68,7 +68,7 @@ test_script: # the interpreter you're using - Appveyor does not do anything special # to put the Python version you want to use on PATH. - set PYTHONIOENCODING=utf-8 - - "%PYTHON%\\python.exe -m pip install pytest-cov==2.8.1" + #- "%PYTHON%\\python.exe -m pip install pytest-cov==2.8.1" - "%PYTHON%\\python.exe -m xdoctest xdoctest" - "%PYTHON%\\python.exe -m pytest -s --xdoctest-verbose=3" diff --git a/requirements/tests.txt b/requirements/tests.txt index 717a8adf..5e2908ba 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,24 +1,21 @@ # Tested with pytest versions: # 5.4.3 -pytest >= 3.3.1 ; python_version > '3.6' - # Pin maximum pytest versions for older python versions -pytest >= 3.3.1, <= 6.2.0 ; python_version < '3.7.0' and python_version >= '3.6.0' -pytest >= 3.3.1, <= 5.0.0 ; python_version < '3.6.0' and python_version >= '3.5.0' -pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5.0' - -typing >= 3.7.4;python_version <= '3.4' - +pytest >= 3.3.1 ; python_version >= '3.7.0' +pytest >= 4.6.0, <= 6.2.0 ; python_version < '3.7.0' and python_version >= '3.6.0' +pytest >= 4.6.0, <= 5.0.0 ; python_version < '3.6.0' and python_version >= '3.5.0' +pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5.0' ## - -pytest-cov > 2.6.0 ; python_version >= '3.6.0' -pytest-cov < 2.6.0 ; python_version < '3.5.0' - +pytest-cov > 2.6.0 ; python_version >= '3.7.0' +pytest-cov > 2.6.0, <=2.8.1 ; python_version < '3.7.0' and python_version >= '3.6.0' +pytest-cov > 2.0.0, < 2.6.0 ; python_version < '3.5.0' codecov >= 2.0.15 +typing >= 3.7.4;python_version <= '3.4' + # For testing doctests in binary extension modules scikit-build cmake From b24191534ba20af82377713103f2277a4f9fe665 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sat, 26 Jun 2021 14:02:41 -0400 Subject: [PATCH 17/20] wip --- requirements/tests.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/requirements/tests.txt b/requirements/tests.txt index 5e2908ba..12d451f1 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -2,15 +2,19 @@ # 5.4.3 # Pin maximum pytest versions for older python versions +# TODO: determine what the actual minimum and maximum acceptable versions of +# pytest (that are also compatible with xdoctest) are for each legacy python +# major.minor version. + pytest >= 3.3.1 ; python_version >= '3.7.0' pytest >= 4.6.0, <= 6.2.0 ; python_version < '3.7.0' and python_version >= '3.6.0' pytest >= 4.6.0, <= 5.0.0 ; python_version < '3.6.0' and python_version >= '3.5.0' pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5.0' ## -pytest-cov > 2.6.0 ; python_version >= '3.7.0' -pytest-cov > 2.6.0, <=2.8.1 ; python_version < '3.7.0' and python_version >= '3.6.0' -pytest-cov > 2.0.0, < 2.6.0 ; python_version < '3.5.0' +pytest-cov > 2.6.0 ; python_version >= '3.7.0' +pytest-cov > 2.6.0, <= 2.8.1 ; python_version < '3.7.0' and python_version >= '3.6.0' +pytest-cov > 2.0.0, < 2.6.0 ; python_version < '3.6.0' codecov >= 2.0.15 From 38c52436129c0287338f577b5d2110827d1fb40b Mon Sep 17 00:00:00 2001 From: joncrall Date: Sat, 26 Jun 2021 15:50:44 -0400 Subject: [PATCH 18/20] Fixed CCI 3.6 test which actually ran 3.5 --- .circleci/config.yml | 2 +- requirements/tests.txt | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8315335c..332ea428 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -493,7 +493,7 @@ jobs: test_full/cp36-36m-linux: <<: *test_full_template docker: - - image: circleci/python:3.5 + - image: circleci/python:3.6 test_full/cp35-35m-linux: <<: *test_full_template diff --git a/requirements/tests.txt b/requirements/tests.txt index 12d451f1..482668a0 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,15 +1,19 @@ # Tested with pytest versions: # 5.4.3 +# 6.2.2 + +# TODO: +# Should run dashboards that test strict and loose versions of the requirements # Pin maximum pytest versions for older python versions # TODO: determine what the actual minimum and maximum acceptable versions of # pytest (that are also compatible with xdoctest) are for each legacy python # major.minor version. - -pytest >= 3.3.1 ; python_version >= '3.7.0' -pytest >= 4.6.0, <= 6.2.0 ; python_version < '3.7.0' and python_version >= '3.6.0' -pytest >= 4.6.0, <= 5.0.0 ; python_version < '3.6.0' and python_version >= '3.5.0' -pytest >= 3.3.1, < 4.7.0 ; python_version < '3.5.0' +pytest >= 4.6.0 ; python_version >= '3.7.0' # Python 3.7+ +pytest >= 4.6.0 ; python_version < '3.7.0' and python_version >= '3.6.0' # Python 3.6 +pytest >= 4.6.0, <= 6.1.2 ; python_version < '3.6.0' and python_version >= '3.5.0' # Python 3.5 +pytest >= 3.3.1, <= 4.6.11 ; python_version < '3.5.0' and python_version >= '3.4.0' # Python 3.4 +pytest >= 3.3.1, <= 4.6.11 ; python_version < '2.8.0' and python_version >= '2.7.0' # Python 2.7 ## pytest-cov > 2.6.0 ; python_version >= '3.7.0' From 03ff9deb19659c64904bb90f8936dd01a1a088a8 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sat, 26 Jun 2021 16:16:27 -0400 Subject: [PATCH 19/20] Try and fix warning again --- xdoctest/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdoctest/plugin.py b/xdoctest/plugin.py index 50ef1a1f..6508fe44 100644 --- a/xdoctest/plugin.py +++ b/xdoctest/plugin.py @@ -269,7 +269,7 @@ def collect(self): _PYTEST_IS_GE_361 = LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') -_PYTEST_IS_GE_361 = 0 +# _PYTEST_IS_GE_361 = 0 def _setup_fixtures(xdoctest_item): From 7609992a57ba6941e52d1a6cb5ef32db62c2130d Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 27 Jun 2021 19:39:49 -0400 Subject: [PATCH 20/20] Attempt to fix pytest version warning --- dev/check_pytest_version_compat.py | 60 ++++++++++++++++++++++++++++++ requirements/jupyter.txt | 1 - xdoctest/plugin.py | 6 +-- 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 dev/check_pytest_version_compat.py diff --git a/dev/check_pytest_version_compat.py b/dev/check_pytest_version_compat.py new file mode 100644 index 00000000..8cb88ec0 --- /dev/null +++ b/dev/check_pytest_version_compat.py @@ -0,0 +1,60 @@ + +import os +import ubelt as ub +from distutils.version import LooseVersion + +os.chdir(ub.expandpath("$HOME/code/pytest")) + +info = ub.cmd('git tag') + +tags = [t for t in info['out'].split('\n') if t] +tags = sorted(tags, key=LooseVersion) + +has_ispytest = {} +language_classifiers = {} + +for tag in ub.ProgIter(tags): + ub.cmd('git checkout {}'.format(tag)) + info = ub.cmd('grep -I -ER _ispytest') + has_ispytest[tag] = len(info['out'].strip()) > 0 + info = ub.cmd('grep -I -ER "Programming Language :: Python" setup.cfg') + language_classifiers[tag] = info['out'] + + +for tag, flag in has_ispytest.items(): + if flag: + break +print('First tag with _pytest = {!r}'.format(tag)) + + +pythonversion_to_supported = ub.ddict(list) +for tag, clfs in language_classifiers.items(): + if clfs != '': + for line in clfs.split('\n'): + pythonversion_to_supported[line.strip()].append(tag) + + +keys = [ + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + +] +for key in keys: + cands = pythonversion_to_supported[key] + if cands: + max_version = max(cands, key=LooseVersion) + print('key = {} max_version = {!r}'.format(key, max_version)) + +# key = Programming Language :: Python :: 2.7 max_version = '4.6.11' +# key = Programming Language :: Python :: 3.4 max_version = '4.6.11' +# key = Programming Language :: Python :: 3.5 max_version = '6.2.0.dev0' +# key = Programming Language :: Python :: 3.6 max_version = '6.3.0.dev0' +# key = Programming Language :: Python :: 3.7 max_version = '6.3.0.dev0' +# key = Programming Language :: Python :: 3.8 max_version = '6.3.0.dev0' +# key = Programming Language :: Python :: 3.9 max_version = '6.3.0.dev0' diff --git a/requirements/jupyter.txt b/requirements/jupyter.txt index a8fee76c..24062109 100644 --- a/requirements/jupyter.txt +++ b/requirements/jupyter.txt @@ -3,4 +3,3 @@ nbconvert; python_version>'3.4' jupyter_client; python_version>'3.4' IPython; python_version>'3.4' ipykernel; python_version>'3.4' - diff --git a/xdoctest/plugin.py b/xdoctest/plugin.py index 6508fe44..d637ed50 100644 --- a/xdoctest/plugin.py +++ b/xdoctest/plugin.py @@ -268,8 +268,8 @@ def collect(self): yield XDoctestItem(name, self, example) -_PYTEST_IS_GE_361 = LooseVersion(pytest.__version__) >= LooseVersion('3.6.1') -# _PYTEST_IS_GE_361 = 0 +_PYTEST_IS_GE_620 = LooseVersion(pytest.__version__) >= LooseVersion('6.2.0') +# _PYTEST_IS_GE_620 = 0 def _setup_fixtures(xdoctest_item): @@ -287,7 +287,7 @@ def func(): # private functionality. Hopefully it wont break, but we should # check to see if there is a better way to do this # https://github.com/pytest-dev/pytest/discussions/8512#discussioncomment-563347 - if _PYTEST_IS_GE_361: + if _PYTEST_IS_GE_620: # The "_ispytest" arg was added in 3.6.1 fixture_request = fixtures.FixtureRequest(xdoctest_item, _ispytest=True) else: