From f3338e0d3bdeb182235f79c1486749a78b99c3f8 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 12 Mar 2022 12:54:53 -0600 Subject: [PATCH] Add support for Python 3.10 (#87) * Bump pytest from 6.2.2 to 6.2.5 pytest 6.2.5 adds support for Python 3.10. [Link](https://github.com/pytest-dev/pytest/pull/8494) to relevant PR. * Add Python 3.10 to strategy matrix * Bump `setup-python` GH action from v1 to v2 * add Python 3.10 trove classifer * switch quotes, trigger tests * fix ci * linting on CI is behaving strangely... * cat watcher.py * fix linting * uprev black Co-authored-by: Samuel Colvin --- .codecov.yml | 9 +++++++++ .github/workflows/ci.yml | 16 ++++++++-------- .gitignore | 2 +- Makefile | 2 ++ setup.py | 4 ++-- tests/requirements-linting.txt | 2 +- tests/requirements.txt | 2 +- watchgod/watcher.py | 7 +++---- 8 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..a23c98b --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,9 @@ +coverage: + precision: 2 + range: [90, 100] + status: + patch: false + project: false + +comment: + layout: 'header, diff, flags, files, footer' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0ccb6a..36c77a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos, windows] - python-version: ['3.6', '3.7', '3.8', '3.9'] + python-version: ['3.7', '3.8', '3.9', '3.10'] runs-on: ${{ matrix.os }}-latest @@ -24,10 +24,10 @@ jobs: OS: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up python - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} @@ -47,11 +47,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v3 with: - python-version: '3.8' + python-version: '3.9' - run: pip install -r tests/requirements-linting.txt @@ -66,12 +66,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up python uses: actions/setup-python@v1 with: - python-version: '3.8' + python-version: '3.9' - name: install run: | diff --git a/.gitignore b/.gitignore index 80c1a3b..49e2078 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /.idea/ /env/ -/env35/ +/env*/ *.py[cod] *.egg-info/ build/ diff --git a/Makefile b/Makefile index e4ff953..6353a7b 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,8 @@ clean: rm -f `find . -type f -name '.*~' ` rm -rf .cache rm -rf htmlcov + rm -rf .pytest_cache + rm -rf .mypy_cache rm -rf *.egg-info rm -f .coverage rm -f .coverage.* diff --git a/setup.py b/setup.py index 84c3b41..1f36068 100644 --- a/setup.py +++ b/setup.py @@ -20,10 +20,10 @@ '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', + 'Programming Language :: Python :: 3.10', 'Intended Audience :: Developers', 'Intended Audience :: Information Technology', 'Intended Audience :: System Administrators', @@ -45,6 +45,6 @@ license='MIT', packages=['watchgod'], package_data={'watchgod': ['py.typed']}, - python_requires='>=3.6', + python_requires='>=3.7', zip_safe=True, ) diff --git a/tests/requirements-linting.txt b/tests/requirements-linting.txt index 3eb0d4c..8c4b15b 100644 --- a/tests/requirements-linting.txt +++ b/tests/requirements-linting.txt @@ -1,4 +1,4 @@ -black==20.8b1 +black==22.1.0 flake8==3.8.4 flake8-quotes==3.2.0 isort==5.7.0 diff --git a/tests/requirements.txt b/tests/requirements.txt index 0adbfc5..32781d9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,6 +1,6 @@ coverage==5.4 pygments==2.7.4 -pytest==6.2.2 +pytest==6.2.5 pytest-cov==2.11.1 pytest-asyncio==0.14.0 pytest-mock==3.5.1 diff --git a/watchgod/watcher.py b/watchgod/watcher.py index c4c07b7..61d9abb 100644 --- a/watchgod/watcher.py +++ b/watchgod/watcher.py @@ -61,17 +61,16 @@ def _walk_dir(self, dir_path: str, changes: Set['FileChange'], new_files: Dict[s if self.should_watch_dir(entry): self._walk_dir(entry.path, changes, new_files) elif self.should_watch_file(entry): - self._watch_file(entry.path, changes, new_files, entry.stat()) - except FileNotFoundError as e: + self._watch_file(entry.path, changes, new_files, entry.stat()) + except FileNotFoundError: # sometimes we can't find the file. If it was deleted since # `entry` was allocated, then it doesn't matter and can be # ignored. It might also be a bad symlink, in which case we # should silently skip it - users don't want to constantly spam - # warnings, esp if they can't remove the symlink (eg from a + # warnings, esp if they can't remove the symlink (e.g. from a # node_modules directory). pass - def check(self) -> Set['FileChange']: changes: Set['FileChange'] = set() new_files: Dict[str, float] = {}