From 02aac777950848dd61a4db5922b601d1265f5c82 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 17 Nov 2020 10:12:16 +0300 Subject: [PATCH 1/4] Update misspell.yml --- .github/workflows/misspell.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/misspell.yml b/.github/workflows/misspell.yml index 83966ab..b0bcb2b 100644 --- a/.github/workflows/misspell.yml +++ b/.github/workflows/misspell.yml @@ -1,6 +1,7 @@ name: misspell on: + workflow_dispatch: schedule: - cron: '0 0 * * *' @@ -12,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: sobolevn/misspell-fixer-action@0.1.0 - - uses: peter-evans/create-pull-request@v2.4.4 + - uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: 'Fixes by misspell-fixer' From 1c49b238bb316d9aac4db8e9bf072bf76742dd63 Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Wed, 24 Mar 2021 21:11:23 +0000 Subject: [PATCH 2/4] Fix typo in collect.py (#48) s/qualifield/qualified/ --- pytest_mypy_plugins/collect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest_mypy_plugins/collect.py b/pytest_mypy_plugins/collect.py index 88f437e..c378e0d 100644 --- a/pytest_mypy_plugins/collect.py +++ b/pytest_mypy_plugins/collect.py @@ -151,6 +151,6 @@ def pytest_addoption(parser: Parser) -> None: group.addoption( "--mypy-extension-hook", type=str, - help="Fully qualifield path to the extension hook function, in case you need custom yaml keys. " + help="Fully qualified path to the extension hook function, in case you need custom yaml keys. " "Has to be top-level.", ) From 9384222a9ec6698a53f91399a4e0988f376bcda0 Mon Sep 17 00:00:00 2001 From: Shin Ahnjae Date: Wed, 19 May 2021 17:01:27 +0900 Subject: [PATCH 3/4] Add option `--mypy-only-local-stub` (#51) * add mypy-only-local-stub config * remove trailing space --- pytest_mypy_plugins/collect.py | 5 +++++ pytest_mypy_plugins/item.py | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pytest_mypy_plugins/collect.py b/pytest_mypy_plugins/collect.py index c378e0d..a527f71 100644 --- a/pytest_mypy_plugins/collect.py +++ b/pytest_mypy_plugins/collect.py @@ -154,3 +154,8 @@ def pytest_addoption(parser: Parser) -> None: help="Fully qualified path to the extension hook function, in case you need custom yaml keys. " "Has to be top-level.", ) + group.addoption( + "--mypy-only-local-stub", + action="store_true", + help="mypy will ignore errors from site-packages", + ) diff --git a/pytest_mypy_plugins/item.py b/pytest_mypy_plugins/item.py index 0f9ec5d..8355a87 100644 --- a/pytest_mypy_plugins/item.py +++ b/pytest_mypy_plugins/item.py @@ -139,6 +139,7 @@ def __init__( self.additional_mypy_config = mypy_config self.parsed_test_data = parsed_test_data self.same_process = self.config.option.mypy_same_process + self.test_only_local_stub = self.config.option.mypy_only_local_stub # config parameters self.root_directory = self.config.option.mypy_testing_base @@ -296,11 +297,12 @@ def runtest(self) -> None: def prepare_mypy_cmd_options(self, execution_path: Path) -> List[str]: mypy_cmd_options = [ "--show-traceback", - "--no-silence-site-packages", "--no-error-summary", "--no-pretty", "--hide-error-context", ] + if not self.test_only_local_stub: + mypy_cmd_options.append("--no-silence-site-packages") if not self.disable_cache: mypy_cmd_options.extend(["--cache-dir", self.incremental_cache_dir]) From 5116e0e7f638c044584aa3f93ad13a458c33e1f4 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sat, 22 May 2021 20:33:12 +0300 Subject: [PATCH 4/4] Version 1.7.0 release --- .github/workflows/test.yml | 8 +++++++- CHANGELOG.md | 7 +++++++ pytest_mypy_plugins/item.py | 3 ++- setup.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 35c20f8..52dc486 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,16 @@ name: test -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - master + pull_request: + workflow_dispatch: jobs: test: runs-on: ubuntu-latest + strategy: matrix: python-version: [3.6, 3.7, 3.8, 3.9] diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d8b120..fc9a92c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Version history +## Version 1.7.0 + +### Features + +- Adds `--mypy-only-local-stub` CLI flag to ignore errors in site-packages + + ## Version 1.6.1 ### Bugfixes diff --git a/pytest_mypy_plugins/item.py b/pytest_mypy_plugins/item.py index 8355a87..775f731 100644 --- a/pytest_mypy_plugins/item.py +++ b/pytest_mypy_plugins/item.py @@ -309,7 +309,8 @@ def prepare_mypy_cmd_options(self, execution_path: Path) -> List[str]: python_version = ".".join([str(part) for part in sys.version_info[:2]]) mypy_cmd_options.append(f"--python-version={python_version}") - # merge self.base_ini_fpath and self.additional_mypy_config into one file and copy to the typechecking folder + # Merge `self.base_ini_fpath` and `self.additional_mypy_config` + # into one file and copy to the typechecking folder: mypy_ini_config = ConfigParser() if self.base_ini_fpath: mypy_ini_config.read(self.base_ini_fpath) diff --git a/setup.py b/setup.py index ecbd5c8..211c849 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="pytest-mypy-plugins", - version="1.6.1", + version="1.7.0", description="pytest plugin for writing tests for mypy plugins", long_description=readme, long_description_content_type="text/markdown",