Skip to content

Commit c21a08f

Browse files
Improve CI
1 parent da4fb1d commit c21a08f

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

.github/workflows/_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jobs:
5050
python-version: ${{ inputs.python-version }}
5151
pip-install: ".[dev,server]"
5252

53-
- name: Run tests
54-
run: tox -e tests
53+
- name: Run unit tests
54+
run: tox -e unit_tests
5555

5656
- name: Upload coverage to Codecov
5757
uses: codecov/codecov-action@v4

pyproject.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ write_to = "src/daq_config_server/_version.py"
5151
reportMissingImports = false # Ignore missing stubs in imported modules
5252

5353
[tool.pytest.ini_options]
54+
asyncio_mode = "auto"
55+
asyncio_default_fixture_loop_scope = "function"
5456
# Run pytest with all our checkers, and don't spam us with massive tracebacks on error
5557
addopts = """
5658
--tb=native -vv
57-
--asyncio-mode=auto
5859
"""
5960
markers = """
60-
uses_live_server: mark a test which uses the live config server
61+
requires_local_server: mark a test which requires locally hosting the config server
6162
"""
6263

6364
# https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings
@@ -79,18 +80,22 @@ legacy_tox_ini = """
7980
[tox]
8081
skipsdist=True
8182
82-
[testenv:{pre-commit,type-checking,tests}]
83+
[testenv]
8384
# Don't create a virtualenv for the command, requires tox-direct plugin
8485
direct = True
8586
passenv = *
8687
allowlist_externals =
8788
pytest
8889
pre-commit
8990
pyright
91+
sphinx-build
92+
sphinx-autobuild
93+
[testenv:{pre-commit,type-checking,unit_tests,system_tests}]
9094
commands =
9195
pre-commit: pre-commit run --all-files --show-diff-on-failure {posargs}
9296
type-checking: pyright src tests {posargs}
93-
tests: pytest -m "not uses_live_server" --cov=daq_config_server --cov-report term --cov-report xml:cov.xml {posargs}
97+
unit_tests: pytest --cov=daq_config_server --cov-report term --cov-report xml:cov.xml {posargs} tests/unit_tests
98+
system_tests: pytest tests/system_tests
9499
"""
95100

96101
[tool.ruff]

src/daq_config_server/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
def main():
1818
parser = ArgumentParser()
1919
parser.add_argument("-v", "--version", action="version", version=__version__)
20+
parser.parse_args()
2021

2122
if not server_dependencies_exist:
2223
print(

tests/__init__.py

Whitespace-only changes.

tests/system_tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
2-
from tests.constants import TEST_DATA_DIR
32

43
from daq_config_server.client import ConfigServer
4+
from tests.constants import TEST_DATA_DIR
55

66
SERVER_ADDRESS = "http://0.0.0.0:8555"
77

@@ -20,11 +20,11 @@ def server():
2020
return ConfigServer(SERVER_ADDRESS)
2121

2222

23+
@pytest.mark.requires_local_server
2324
def test_read_unformatted_file(server: ConfigServer):
2425
file_path = f"{TEST_DATA_DIR}/beamline_parameters.txt"
2526
with open(file_path) as f:
2627
expected_response = f.read()
27-
print("hing")
2828
assert (
2929
server.read_unformatted_file(f"{TEST_DATA_DIR}/beamline_parameters.txt")
3030
== expected_response

tests/unit_tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import pytest
55
from fastapi import status
66
from fastapi.testclient import TestClient
7-
from tests.constants import TEST_DATA_DIR
87

98
from daq_config_server import app
109
from daq_config_server.constants import ENDPOINTS
10+
from tests.constants import TEST_DATA_DIR
1111

1212

1313
@pytest.fixture

0 commit comments

Comments
 (0)