Skip to content

Commit a94a99d

Browse files
committed
fix: tests were not being run
1 parent 6ed9174 commit a94a99d

4 files changed

Lines changed: 11 additions & 42 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ dev = ["pytest>=8.3.4", "ruff>=0.9.7"]
2424

2525
# Tell pytest that all files in the /tests directory are tests
2626
[tool.pytest.ini_options]
27-
testpaths = ["tests"]
2827
python_files = "tests/*.py"
28+
# testpaths = ["tests"]
2929
python_functions = "test_*"
3030
python_classes = "Test*"
3131

tests/testing.py renamed to tests/bootinfo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,4 @@ def inject_valid_service():
3535
}
3636
}
3737

38-
os.environ["ASE_SERVICE"] = json.dumps(service)
39-
40-
38+
os.environ["ASE_SERVICE"] = json.dumps(service)

tests/basic.py renamed to tests/test_basic.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
from loguru import logger
99
import roverlib.rovercom as rovercom
1010
import threading
11-
from .testing import inject_valid_service
11+
from .bootinfo import inject_valid_service
1212

1313
runThread = True
1414

15-
16-
17-
1815
def send_continuous(stream : rover.WriteStream):
1916
while runThread:
2017
time.sleep(1)
@@ -56,32 +53,20 @@ def run(service : rover.Service, configuration : rover.ServiceConfiguration):
5653
thread_send = threading.Thread(target=send_continuous, args=(wr,), daemon=True)
5754
thread_send.start()
5855

59-
60-
6156
output = rd.Read()
6257

6358
global runThread
6459
runThread = False
65-
6660

6761
assert output.sensor_id == 2
6862

69-
70-
71-
72-
73-
74-
7563

7664
def onTerminate(sig : signal):
7765
logger.info("Terminating")
7866
return None
7967

8068

81-
82-
inject_valid_service()
83-
84-
85-
rover.Run(run, onTerminate)
86-
69+
def test_basic():
70+
inject_valid_service()
71+
rover.Run(run, onTerminate)
8772

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
"""
2-
tests for tuning
2+
Tests for tuning
33
"""
44

5-
65
import roverlib as rover
76
import time
87
import signal
98
from loguru import logger
109
import roverlib.rovercom as rovercom
1110
import zmq
12-
from .testing import inject_valid_service
13-
14-
11+
from .bootinfo import inject_valid_service
1512

1613
def run(service : rover.Service, configuration : rover.ServiceConfiguration):
1714
######################################################
18-
1915
time.sleep(2)
20-
2116
context = zmq.Context()
22-
2317
socket = context.socket(zmq.PUB)
2418
socket.bind("tcp://*:8829")
2519

2620
assert abs(configuration.GetFloatSafe("speed") - 1.5) < 0.01
27-
2821

2922
tuning = rovercom.TuningState(timestamp=int(time.time() * 1000), dynamic_parameters=[
3023
rovercom.TuningStateParameter(number=rovercom.TuningStateParameterNumberParameter(key="speed",value=1.1))
@@ -42,17 +35,10 @@ def run(service : rover.Service, configuration : rover.ServiceConfiguration):
4235

4336

4437

45-
46-
47-
4838
def onTerminate(sig : signal):
4939
logger.info("Terminating")
5040
return None
5141

52-
53-
54-
55-
inject_valid_service()
56-
57-
58-
rover.Run(run, onTerminate)
42+
def test_validation():
43+
inject_valid_service()
44+
rover.Run(run, onTerminate)

0 commit comments

Comments
 (0)