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

Problem: hatch envs needed manual manipulation for testing #589

Closed
wants to merge 2 commits into from
Closed
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
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
5 changes: 3 additions & 2 deletions examples/example_fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from datetime import datetime
from os import listdir
from pathlib import Path
from typing import Dict, Optional
from typing import Dict, Optional, TYPE_CHECKING

import aiohttp
from fastapi import FastAPI
Expand All @@ -18,7 +18,8 @@
from starlette.responses import JSONResponse

# FIXME: This import fails to work in a VM when using pytest
# from aleph.sdk.chains.remote import RemoteAccount
if TYPE_CHECKING:
from aleph.sdk.chains.remote import RemoteAccount
from aleph.sdk.client import AlephClient, AuthenticatedAlephClient
from aleph.sdk.types import StorageEnum
from aleph.sdk.vm.app import AlephApp
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
Loading