From 73f530b0a15622b71c752a9d687110c9a3baa28f Mon Sep 17 00:00:00 2001 From: kshivakumar Date: Tue, 1 Feb 2022 12:41:18 +0530 Subject: [PATCH 1/4] Fix 'clean' fixture --- tests/test_user_config.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/test_user_config.py b/tests/test_user_config.py index 54fa885..2e72e4a 100644 --- a/tests/test_user_config.py +++ b/tests/test_user_config.py @@ -12,14 +12,6 @@ @pytest.fixture def clean(): - DEFAULT_CONFIG_FILE = os.path.join(os.path.expanduser('~'), '.pdir2config') - yield DEFAULT_CONFIG_FILE - if 'PDIR2_CONFIG_FILE' in os.environ: - if os.path.exists(os.environ['PDIR2_CONFIG_FILE']): - os.remove(os.environ['PDIR2_CONFIG_FILE']) - del os.environ['PDIR2_CONFIG_FILE'] - if os.path.exists(DEFAULT_CONFIG_FILE): - os.remove(DEFAULT_CONFIG_FILE) for module in ( 'pdir', 'pdir.api', @@ -33,6 +25,15 @@ def clean(): del modules[module] except KeyError: pass + + DEFAULT_CONFIG_FILE = os.path.join(os.path.expanduser('~'), '.pdir2config') + yield DEFAULT_CONFIG_FILE + if 'PDIR2_CONFIG_FILE' in os.environ: + if os.path.exists(os.environ['PDIR2_CONFIG_FILE']): + os.remove(os.environ['PDIR2_CONFIG_FILE']) + del os.environ['PDIR2_CONFIG_FILE'] + if os.path.exists(DEFAULT_CONFIG_FILE): + os.remove(DEFAULT_CONFIG_FILE) def test_default_env_without_config(clean): From 60ce85b718c239d2c97246466683ca659c29fb16 Mon Sep 17 00:00:00 2001 From: kshivakumar Date: Sat, 5 Feb 2022 11:18:39 +0530 Subject: [PATCH 2/4] Add .vscode to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cff7332..4cf9c2f 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ coverage.xml .project .pydevproject .idea +.vscode # Rope .ropeproject From 16765568045001bd24f8bd54be1b71722d1c565b Mon Sep 17 00:00:00 2001 From: kshivakumar Date: Sun, 6 Feb 2022 10:25:43 +0530 Subject: [PATCH 3/4] Suppress mypy 'colorama' import error --- pdir/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdir/api.py b/pdir/api.py index 9806948..317a790 100644 --- a/pdir/api.py +++ b/pdir/api.py @@ -20,7 +20,7 @@ from . import format if platform.system() == 'Windows': - from colorama import init + from colorama import init # type: ignore init() # To support Windows. From d484ff9fcd76c6e5fe6ba487e9ece3b5f9d67bd6 Mon Sep 17 00:00:00 2001 From: kshivakumar Date: Sun, 6 Feb 2022 12:59:39 +0530 Subject: [PATCH 4/4] Suppress mypy 'pytest' import errors --- pdm.lock | 2 +- pyproject.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pdm.lock b/pdm.lock index 693667f..065251d 100644 --- a/pdm.lock +++ b/pdm.lock @@ -523,7 +523,7 @@ summary = "Backport of pathlib-compatible object wrapper for zip files" [metadata] lock_version = "3.1" -content_hash = "sha256:5f19b76a78d78ce629ff32c73765b74a1fc0fd11de091e7167b04fd50024f615" +content_hash = "sha256:2602c26d1397cce1eb7c1e675ba60538eb19f3d4f62ecdad24fa4ef4289e9b75" [metadata.files] "appdirs 1.4.4" = [ diff --git a/pyproject.toml b/pyproject.toml index 567058b..fb9add5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,3 +53,7 @@ build-backend = "pdm.pep517.api" [tool.black] skip-string-normalization = true + +[[tool.mypy.overrides]] +module = ["pytest"] +ignore_missing_imports = true \ No newline at end of file