Skip to content

Commit

Permalink
Test UCX over Python v3.10, v3.11, and v3.12 (#2195)
Browse files Browse the repository at this point in the history
Fix #2192
  • Loading branch information
nfx authored Jul 16, 2024
1 parent bfc72e2 commit 7cdf230
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ env:
jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pyVersion: [ '3.10', '3.11', '3.12' ]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -31,7 +35,7 @@ jobs:
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
python-version: '3.10'
python-version: ${{ matrix.pyVersion }}

- name: Install hatch
run: pip install hatch==$HATCH_VERSION
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ To begin, run `make dev` to create the default environment and install developme
make dev
```

To use different python version, specify it in `HATCH_PYTHON` variable:
```shell
HATCH_PYTHON=python3.10 make clean dev test
```

Configure your IDE to use `.venv/bin/python` from the virtual environment when developing the project:
![IDE Setup](docs/hatch-intellij.gif)

Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ dependencies = [
"types-requests~=2.31.0",
]

python="3.10"

# store virtual env as the child of this folder. Helps VSCode (and PyCharm) to run better
path = ".venv"

Expand Down
12 changes: 5 additions & 7 deletions tests/unit/source_code/linters/test_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import tempfile
from pathlib import Path
from unittest.mock import Mock, create_autospec

Expand Down Expand Up @@ -83,16 +82,15 @@ def test_migrator_supported_language_no_fixer():
languages.fixer.assert_called_once_with(Language.PYTHON, 'some-code')


def test_migrator_supported_language_with_fixer():
def test_migrator_supported_language_with_fixer(tmpdir):
languages = create_autospec(LinterContext)
languages.linter(Language.PYTHON).lint.return_value = [Mock(code='some-code')]
languages.fixer(Language.PYTHON, 'some-code').apply.return_value = "Hi there!"
migrator = LocalFileMigrator(lambda: languages)
with tempfile.NamedTemporaryFile(mode="w+t", suffix=".py") as file:
file.writelines(["import tempfile"])
path = Path(file.name)
migrator.apply(path)
assert file.readline() == "Hi there!"
path = Path(tmpdir, 'any.py')
path.write_text("import tempfile", encoding='utf-8')
migrator.apply(path)
assert path.read_text("utf-8") == "Hi there!"


def test_migrator_walks_directory():
Expand Down

0 comments on commit 7cdf230

Please sign in to comment.