Skip to content

Test UCX over Python v3.10, v3.11, and v3.12 #2195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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