Skip to content

Commit 8566962

Browse files
committed
Add testing to dist
1 parent df6ccb7 commit 8566962

File tree

6 files changed

+57
-110
lines changed

6 files changed

+57
-110
lines changed

.github/workflows/dist.yml

+11
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,14 @@ jobs:
2222
WPI_ARTIFACTORY_USERNAME: ${{ secrets.WPI_ARTIFACTORY_USERNAME }}
2323
WPI_ARTIFACTORY_TOKEN: ${{ secrets.WPI_ARTIFACTORY_TOKEN }}
2424
PYPI_API_TOKEN: ${{ secrets.PYPI_PASSWORD }}
25+
26+
check-example-headers:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-python@v4
31+
with:
32+
python-version: 3.12
33+
- name: Check header
34+
run: python examples/check_header.py
35+
shell: bash

.github/workflows/test.yml

-52
This file was deleted.

examples/run_examples.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os
2+
import subprocess
3+
import sys
4+
5+
BASE_TESTS = [
6+
"can-arcade-drive",
7+
"can-tank-drive",
8+
"getting-started",
9+
"limit-switch",
10+
]
11+
12+
IGNORED_TESTS = [
13+
"color_match",
14+
"get-set-params",
15+
"maxswerve",
16+
"position-pid-control",
17+
"read_rgb_values",
18+
"read-encoder-values",
19+
"smart-motion",
20+
"velocity-pid-control",
21+
] # Add ignored tests if any
22+
EVERY_TESTS = BASE_TESTS + IGNORED_TESTS
23+
TESTS = BASE_TESTS
24+
25+
script_dir = os.path.dirname(__file__)
26+
27+
robot_files = []
28+
for root, dirs, files in os.walk("."):
29+
if "robot.py" in files:
30+
robot_files.append(os.path.relpath(root, "."))
31+
32+
for file in robot_files:
33+
print("found: " + file)
34+
if file not in EVERY_TESTS:
35+
if not os.getenv("FORCE_ANYWAYS"):
36+
print("ERROR: Not every robot.py file is in the list of tests!")
37+
exit(1)
38+
39+
for test in TESTS:
40+
print(f"Running test: {test}")
41+
os.chdir(os.path.join(script_dir, test))
42+
subprocess.run([sys.executable, "-m", "robotpy", "test", "--builtin"])
43+
os.chdir(script_dir)

examples/run_tests.sh

-58
This file was deleted.

tests/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pytest
2+
robotpy

tests/run_tests.py

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
os.chdir(root)
1111

1212
subprocess.check_call([sys.executable, "-m", "pytest"])
13+
14+
subprocess.check_call([sys.executable, "../examples/run_examples.py"])

0 commit comments

Comments
 (0)