diff --git a/TESTING.md b/TESTING.md index ff3b9d534..67f9143b5 100644 --- a/TESTING.md +++ b/TESTING.md @@ -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 diff --git a/examples/example_fastapi/main.py b/examples/example_fastapi/main.py index 0c847177a..5d01ac8b0 100644 --- a/examples/example_fastapi/main.py +++ b/examples/example_fastapi/main.py @@ -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 @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 9486427d9..fb610434b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",