Skip to content

Commit d2e22e3

Browse files
authored
Some general pytest cleanup (#1021)
- Individual tests must complete in less than 5 minutes - Add a `make test` option that runs tests - Upgrade poetry to 2.1.1 (the lock file was generated by this version, so this just matches what we already expect)
1 parent 72b5c73 commit d2e22e3

File tree

7 files changed

+33
-6
lines changed

7 files changed

+33
-6
lines changed

.github/workflows/python_sdk_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ jobs:
5050
run: poetry build
5151

5252
- name: Run tests
53-
run: poetry run pytest --verbose -x
53+
run: make test
5454
env:
5555
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ deno 1.46.3
22
nodejs 20.19.5
33
pnpm 9.15.5
44
python 3.9
5-
poetry 1.8.3
5+
poetry 2.1.1

packages/python-sdk/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,12 @@ generate-mcp:
3939
--class-name McpServer \
4040
--use-field-description \
4141
--disable-timestamp \
42-
--extra-fields forbid
42+
--extra-fields forbid
43+
44+
.PHONY: setup
45+
setup:
46+
poetry install
47+
48+
.PHONY: test
49+
test: setup
50+
poetry run pytest --verbose --numprocesses=4

packages/python-sdk/poetry.lock

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/python-sdk/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pytest-asyncio = "^0.23.7"
3131
pydoc-markdown = "^4.8.2"
3232
datamodel-code-generator = "^0.34.0"
3333
ruff = "^0.11.12"
34+
pytest-timeout = "^2.4.0"
3435

3536
[build-system]
3637
requires = ["poetry-core"]

packages/python-sdk/pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ markers =
44
skip_debug: skip test if E2B_DEBUG is set.
55

66
asyncio_mode=auto
7-
addopts = "--import-mode=importlib" "--numprocesses=4"
7+
addopts = "--import-mode=importlib"
8+
timeout = 300

packages/python-sdk/tests/test_connection_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from e2b import ConnectionConfig
22

33

4-
def test_api_url_defaults_correctly():
4+
def test_api_url_defaults_correctly(monkeypatch):
5+
monkeypatch.setenv("E2B_DOMAIN", "")
6+
57
config = ConnectionConfig()
68
assert config.api_url == "https://api.e2b.app"
79

0 commit comments

Comments
 (0)