Skip to content
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

Fix tests breaking on macos #1976

Merged
merged 1 commit into from
Jan 21, 2025
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: 3 additions & 3 deletions .github/workflows/test_matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"container": "ghcr.io/agnostiqhq/covalent-dev/debian12-py310:latest",
"backend": "local",
"experimental": false,
"trigger": ["schedule", "workflow_dispatch"]
"trigger": ["schedule", "workflow_dispatch", "pull_request"]
},
{
"name": "Debian 12 / Python 3.11 / Dask",
Expand All @@ -29,7 +29,7 @@
"container": "ghcr.io/agnostiqhq/covalent-dev/debian12-py311:latest",
"backend": "local",
"experimental": false,
"trigger": ["schedule", "workflow_dispatch"]
"trigger": ["schedule", "workflow_dispatch", "pull_request"]
},
{
"name": "Debian 12 / Python 3.12 / Dask",
Expand All @@ -45,7 +45,7 @@
"container": "ghcr.io/agnostiqhq/covalent-dev/debian12-py312:latest",
"backend": "local",
"experimental": false,
"trigger": ["schedule", "workflow_dispatch"]
"trigger": ["schedule", "workflow_dispatch", "pull_request"]
},
{
"name": "MacOS 13 / Python 3.10 / Dask",
Expand Down
48 changes: 24 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,30 @@ jobs:
if: steps.build-dist.outcome == 'success'
run: pip install dist/covalent-*.tar.gz

- name: Run SDK tests and measure coverage
id: sdk-tests
if: >
steps.modified-files.outputs.sdk == 'true'
|| env.BUILD_AND_RUN_ALL
run: PYTHONPATH=$PWD/ pytest -vvs --reruns=5 tests/covalent_tests --cov=covalent --cov-config=.coveragerc

- name: Generate SDK coverage report
id: sdk-coverage
if: steps.sdk-tests.outcome == 'success'
run: coverage xml -o sdk_coverage.xml

- name: Run dispatcher tests and measure coverage
id: dispatcher-tests
if: >
steps.modified-files.outputs.dispatcher == 'true'
|| env.BUILD_AND_RUN_ALL
run: PYTHONPATH=$PWD/ pytest -vvs --reruns=5 tests/covalent_dispatcher_tests --cov=covalent_dispatcher --cov-config=.coveragerc

- name: Generate dispatcher coverage report
id: dispatcher-coverage
if: steps.dispatcher-tests.outcome == 'success'
run: coverage xml -o dispatcher_coverage.xml

- name: Start Covalent dispatcher server
if: env.BUILD_AND_RUN_ALL
id: covalent_start
Expand All @@ -230,30 +254,6 @@ jobs:
covalent cluster --info
covalent cluster --logs

- name: Run SDK tests and measure coverage
id: sdk-tests
if: >
steps.modified-files.outputs.sdk == 'true'
|| env.BUILD_AND_RUN_ALL
run: PYTHONPATH=$PWD/ pytest -vvs --reruns=5 tests/covalent_tests --cov=covalent --cov-config=.coveragerc

- name: Generate SDK coverage report
id: sdk-coverage
if: steps.sdk-tests.outcome == 'success'
run: coverage xml -o sdk_coverage.xml

- name: Run dispatcher tests and measure coverage
id: dispatcher-tests
if: >
steps.modified-files.outputs.dispatcher == 'true'
|| env.BUILD_AND_RUN_ALL
run: PYTHONPATH=$PWD/ pytest -vvs --reruns=5 tests/covalent_dispatcher_tests --cov=covalent_dispatcher --cov-config=.coveragerc

- name: Generate dispatcher coverage report
id: dispatcher-coverage
if: steps.dispatcher-tests.outcome == 'success'
run: coverage xml -o dispatcher_coverage.xml

- name: Run functional tests and measure coverage
id: functional-tests
if: env.BUILD_AND_RUN_ALL
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Disabled codecov in CI
- Removed qelectron tests from CI
- Updated recommended platform to Python 3.12
- Run local executor tests for PRs

### Fixed

- `get_result(wait=True)` no longer times out
- Fixed tests on mac

### Changed

Expand Down
10 changes: 7 additions & 3 deletions tests/covalent_dispatcher_tests/_cli/service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,15 @@ def test_python_path_in_venv():
venv.create(tmp_dir, with_pip=False)
custom_env = os.environ.copy()
# equivalent of source venv/bin/activate
custom_env["VIRTUAL_ENV"] = tmp_dir
custom_env["VIRTUAL_ENV"] = os.path.realpath(tmp_dir)
custom_env["PATH"] = f"{tmp_dir}/bin:$PATH"
check_path_cmd = ["python", "-c", "import sys; print(sys.executable)"]
check_path_cmd = [
"python",
"-c",
"import os; import sys; print(os.path.realpath(sys.executable))",
]
res = subprocess.run(check_path_cmd, check=True, capture_output=True, env=custom_env)
assert res.stdout.decode().startswith(tmp_dir)
assert res.stdout.decode().startswith(os.path.realpath(tmp_dir))


def test_read_pid_nonexistent_file():
Expand Down
Loading