Skip to content

Commit

Permalink
Problem: hatch envs needed manual manipulation for testing
Browse files Browse the repository at this point in the history
Solution: Modify hatch configuration to have the environmnent properly set up using the virtual environment builtin module

https://hatch.pypa.io/1.3/plugins/environment/virtual/
  • Loading branch information
olethanh committed Apr 10, 2024
1 parent af5b5fd commit 53b52b6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
17 changes: 0 additions & 17 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,6 @@ Create the testing virtual environment:
hatch env create testing
```

Obtain the path to the testing virtual environment.
```
hatch run testing:which python
```

Locate the file named `pyvenv.cfg` in your virtual environment.
Edit it to use system site packages:
```
vim /root/.local/share/hatch/env/virtual/aleph-vm/i5XWCcQ_/testing/pyvenv.cfg
```

Set `include-system-site-packages` to `true`.

Remove the Python library `nftables` from the `hatch` virtual environment:
```shell
hatch run testing:pip uninstall nftables
```

## 4. Run tests

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ config = "aleph-vm orchestrator config {args:--help}"
check = "aleph-vm controller run {args:--help}"

[tool.hatch.envs.testing]
type = "virtual"
system-packages = true
dependencies = [
"pytest==8.0.1",
"pytest-cov==4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/supervisor/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ async def test_create_execution_online():
assert vm.vm_id == 3

await execution.start()
await execution.stop()
await execution.stop()

0 comments on commit 53b52b6

Please sign in to comment.