diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b77fcb47b..8f8d2950b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,13 +43,13 @@ repos: exclude: "asdf/(extern||_jsonschema)/.*" - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.287' + rev: 'v0.0.288' hooks: - id: ruff args: ["--fix"] - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black diff --git a/asdf/_tests/test_generic_io.py b/asdf/_tests/test_generic_io.py index 24860913a..31030ed73 100644 --- a/asdf/_tests/test_generic_io.py +++ b/asdf/_tests/test_generic_io.py @@ -401,7 +401,7 @@ def test_invalid_obj(tmp_path): def test_nonseekable_file(tmp_path): - base = io.IOBase + base = io.FileIO class FileWrapper(base): def tell(self): diff --git a/asdf/conftest.py b/asdf/conftest.py index e327cc1d5..97ef87ce4 100644 --- a/asdf/conftest.py +++ b/asdf/conftest.py @@ -1,4 +1,32 @@ +import os + +import pytest + # We ignore these files because these modules create deprecation warnings on # import. When warnings are turned into errors this will completely prevent # test collection collect_ignore = ["asdftypes.py", "fits_embed.py", "resolver.py", "type_index.py", "types.py", "tests/helpers.py"] + + +@pytest.fixture(scope="session", autouse=True) +def _temp_cwd(tmpdir_factory): + """ + This fixture creates a temporary current working directory + for the test session, so that docstring tests that write files + don't clutter up the real cwd. + """ + original_cwd = os.getcwd() + try: + os.chdir(tmpdir_factory.mktemp("cwd")) + yield + finally: + os.chdir(original_cwd) + + +def pytest_addoption(parser): + parser.addoption( + "--jsonschema", + action="store_true", + default=False, + help="Run jsonschema test suite tests", + ) diff --git a/conftest.py b/conftest.py deleted file mode 100644 index 342acd162..000000000 --- a/conftest.py +++ /dev/null @@ -1,27 +0,0 @@ -import os - -import pytest - - -@pytest.fixture(scope="session", autouse=True) -def _temp_cwd(tmpdir_factory): - """ - This fixture creates a temporary current working directory - for the test session, so that docstring tests that write files - don't clutter up the real cwd. - """ - original_cwd = os.getcwd() - try: - os.chdir(tmpdir_factory.mktemp("cwd")) - yield - finally: - os.chdir(original_cwd) - - -def pytest_addoption(parser): - parser.addoption( - "--jsonschema", - action="store_true", - default=False, - help="Run jsonschema test suite tests", - )