Repository: bskinn/sphobjinv (language: python)

Issue:
Update usage of `pytest-check` and add version constraint
Obsolete syntax discovered in https://github.com/bskinn/sphobjinv/issues/264#issuecomment-1323935399.




Discussion / hints:
Fix is described at https://github.com/bskinn/sphobjinv/issues/264#issuecomment-1324030814

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 915bc21..d941a96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,22 @@ and this project strives to adhere to
 
   * The `sys.exit()` in the case of no objects falling above the 'suggest' search threshold was refactored into the main `do_suggest()` body, to minimize the surprise of an `exit()` call coming in a subfunction. ([#263](https://github.com/bskinn/sphobjinv/issues/263))
 
+#### Testing
+
+  * The constraint for `pytest-check` was bumped to `>=1.1.2` and all uses of
+    the `check` fixture were revised from `with check.check(...):` to
+    `with check(...):`. ([#265](https://github.com/bskinn/sphobjinv/issues/265))
+
+  * Azure Pipelines now has Python 3.11 available for all of Ubuntu, Windows and
+    MacOS, so it was added to the core text matrix for all platforms.
+
+#### Administrative
+
+  * The version bump on `pytest-check` no longer permits the use of Python 3.6
+    in CI. As Python 3.6 is nearly a year beyond EOL, this seems a reasonable
+    time to officially drop support for it. `python_requires` will still be at
+    `>=3.6` for now; it *should* still work for 3.6...but, no guarantees.
+
 
 ### [2.3] - 2022-11-08
 
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 7ca1dcc..a75333f 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -59,8 +59,6 @@ stages:
   - template: azure-coretest.yml
     parameters:
       pythons:
-        py36:
-          spec: '3.6'
         py37:
           spec: '3.7'
         py38:
@@ -69,6 +67,8 @@ stages:
           spec: '3.9'
         py310:
           spec: '3.10'
+        py311:
+          spec: '3.11'
         pypy3:
           spec: 'pypy3'
       platforms: [linux]
@@ -84,6 +84,8 @@ stages:
           spec: '3.9'
         py310:
           spec: '3.10'
+        py311:
+          spec: '3.11'
       platforms: [windows, macOs]
 
 
diff --git a/requirements-ci.txt b/requirements-ci.txt
index 0646ec4..e2ab803 100644
--- a/requirements-ci.txt
+++ b/requirements-ci.txt
@@ -6,7 +6,7 @@ dictdiffer
 jsonschema
 md-toc
 pytest>=4.4.0
-pytest-check>=0.4
+pytest-check>=1.1.2
 pytest-cov
 pytest-ordering
 pytest-timeout
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 0cba0c8..3a15831 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -9,7 +9,7 @@ md-toc
 pep517
 pre-commit
 pytest>=4.4.0
-pytest-check>=0.4
+pytest-check>=1.1.2
 pytest-cov
 pytest-ordering
 pytest-timeout
diff --git a/requirements-flake8.txt b/requirements-flake8.txt
index 833ef9e..3151acc 100644
--- a/requirements-flake8.txt
+++ b/requirements-flake8.txt
@@ -1,5 +1,5 @@
 colorama
-flake8>=5
+flake8>=5,<6
 flake8-2020
 flake8-absolute-import
 flake8-bandit
diff --git a/setup.cfg b/setup.cfg
index cab8eb0..73a021b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -24,7 +24,6 @@ classifiers =
     Programming Language :: Python
     Programming Language :: Python :: 3
     Programming Language :: Python :: 3 :: Only
-    Programming Language :: Python :: 3.6
     Programming Language :: Python :: 3.7
     Programming Language :: Python :: 3.8
     Programming Language :: Python :: 3.9
diff --git a/tox.ini b/tox.ini
index e396557..f8bfe0d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,7 +3,7 @@ minversion=2.0
 isolated_build=True
 envlist=
     # Test all Python versions on latest lib versions
-    py3{6,7,8,9,10,11}-sphx_latest-attrs_latest-jsch_latest
+    py3{7,8,9,10,11}-sphx_latest-attrs_latest-jsch_latest
     # Test dev Python version on current in-repo dev lib versions
     py310-sphx_dev-attrs_dev-jsch_dev
     # Scan across Sphinx versions
@@ -15,7 +15,7 @@ envlist=
     # Scan jsonschema versions
     py310-sphx_latest-attrs_latest-jsch_{3_0,3_1,3_2,4_0,4_1,dev}
     # Earliest supported Python and lib versions all together
-    py36-sphx_1_6_x-attrs_19_2-jsch_3_0
+    py37-sphx_1_6_x-attrs_19_2-jsch_3_0
     # Spot matrix of early Python, Sphinx, attrs versions
     py3{7,8,9}-sphx_{1,2}_x-attrs_{19,20}_2-jsch_latest
     # Test the specific Sphinx threshold cases where behavior changed
@@ -84,7 +84,6 @@ basepython=
     py39: python3.9
     py38: python3.8
     py37: python3.7
-    py36: python3.6
 
 [testenv:flake8]
 skip_install=True


Test patch:
diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml
index 18ea8d8..7565e8e 100644
--- a/.github/workflows/ci_tests.yml
+++ b/.github/workflows/ci_tests.yml
@@ -63,7 +63,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python: ['3.6', '3.7', '3.8', '3.9', '3.11']
+        python: ['3.7', '3.8', '3.9', '3.11']
     if: "!contains(github.event.head_commit.message, '[skip ci]')"
 
     steps:
diff --git a/tests/test_api_good.py b/tests/test_api_good.py
index f3889b7..2712d4b 100644
--- a/tests/test_api_good.py
+++ b/tests/test_api_good.py
@@ -366,17 +366,17 @@ def test_api_inventory_bytes_fname_instantiation(
             source = soi.readbytes(source)
 
         # General import, without a specified kwarg
-        with check.check(msg="general"):
+        with check(msg="general"):
             attrs_inventory_test(soi.Inventory(source), source_type)
 
         # Importing with the respective kwarg for each source type
-        with check.check(msg="specific"):
+        with check(msg="specific"):
             inv = soi.Inventory(**{inv_arg: source})
             attrs_inventory_test(inv, source_type)
 
         # Special case for plaintext bytes, try decoding it
         if source_type is soi.SourceTypes.BytesPlaintext:
-            with check.check(msg="plaintext_bytes"):
+            with check(msg="plaintext_bytes"):
                 inv = soi.Inventory(**{inv_arg: source.decode("utf-8")})
                 attrs_inventory_test(inv, source_type)
 
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 2fcb3ca..b1d5748 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -479,10 +479,10 @@ def test_clifail_convert_localfile_as_url(
 
         (scratch_path / (misc_info.FNames.INIT + misc_info.Extensions.DEC)).unlink()
 
-        with check.check(msg="path-style"):
+        with check(msg="path-style"):
             run_cmdline_test(["convert", "plain", "-u", str(in_path)], expect=1)
 
-        with check.check(msg="url-style"):
+        with check(msg="url-style"):
             file_url = "file:///" + str(in_path.resolve())
             run_cmdline_test(["convert", "plain", "-u", file_url], expect=1)
 
diff --git a/tests/test_fixture.py b/tests/test_fixture.py
index 398cfed..985e5a3 100644
--- a/tests/test_fixture.py
+++ b/tests/test_fixture.py
@@ -45,7 +45,7 @@ def test_populate_scratch(misc_info, scratch_path, check):
     scr_base = misc_info.FNames.INIT.value
 
     for ext in [_.value for _ in misc_info.Extensions]:
-        with check.check(msg=ext):
+        with check(msg=ext):
             assert (scratch_path / f"{scr_base}{ext}").is_file(), ext
 
 
diff --git a/tests/test_flake8_ext.py b/tests/test_flake8_ext.py
index 9bd05bf..2255488 100644
--- a/tests/test_flake8_ext.py
+++ b/tests/test_flake8_ext.py
@@ -69,5 +69,5 @@ def test_flake8_version_output(check):
     )  # noqa: S607,S603
 
     for p in plugins:
-        with check.check(msg=p):
+        with check(msg=p):
             assert p in flake8_ver_output.replace("_", "-").replace("\n", "")
diff --git a/tests/test_readme.py b/tests/test_readme.py
index d22a1e9..4b5086f 100644
--- a/tests/test_readme.py
+++ b/tests/test_readme.py
@@ -103,5 +103,5 @@ def test_readme_shell_cmds(ensure_doc_scratch, is_win, check):
 
         msg = "\n\nExpected:\n" + out + "\n\nGot:\n" + result
 
-        with check.check():
+        with check():
             assert chk.check_output(out, result, dt_flags), msg