Skip to content

Commit eb5e5a8

Browse files
committed
Simplify tests
1 parent 131e35c commit eb5e5a8

File tree

4 files changed

+20
-108
lines changed

4 files changed

+20
-108
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ jobs:
4242
long_test_linux:
4343
runs-on: ubuntu-latest
4444
steps:
45-
- name: Install packages
46-
run: |
47-
sudo apt-get update
48-
sudo apt-get install -y linux-tools-common linux-tools-generic
4945
- uses: actions/checkout@v4
5046
- uses: actions/setup-python@v5
5147
with:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ flags = ["TAILCALL"]
8383
runners = ["linux_clang", "darwin", "windows_clang"]
8484
```
8585

86+
### Long-running tests
87+
88+
`bench-runner` has some new long-running end-to-end integration tests. To avoid running them, use:
89+
90+
```
91+
python -m pytest -m "not long_running"
92+
```
93+
8694
## v1.8.0
8795

8896
### bench_runner.toml change

tests/test_notify.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import contextlib
22
from pathlib import Path
3-
import textwrap
43

54

65
from bench_runner import gh
@@ -31,17 +30,18 @@ def send_notification(message):
3130
)
3231

3332
captured = capsys.readouterr()
34-
assert (
35-
captured.out.strip()
36-
== "::notice ::@test_actor: [test_fork/test_ref](https://github.com/test_repo-public/tree/main/results/bm-20231001-3.10.4-test_he-JIT,TAILCALL)"
33+
assert captured.out.strip() == (
34+
"::notice ::@test_actor: "
35+
"[test_fork/test_ref]"
36+
"(https://github.com/test_repo-public/tree/main/results/"
37+
"bm-20231001-3.10.4-test_he-JIT,TAILCALL)"
3738
)
3839

39-
expected = textwrap.dedent(
40-
"""
41-
🤖 This is the friendly benchmarking bot with some new results!
42-
43-
@test_actor: [test_fork/test_ref](https://github.com/test_repo-public/tree/main/results/bm-20231001-3.10.4-test_he-JIT,TAILCALL)
44-
"""
45-
).strip()
40+
expected = (
41+
"@test_actor: "
42+
"[test_fork/test_ref]"
43+
"(https://github.com/test_repo-public/tree/main/results/"
44+
"bm-20231001-3.10.4-test_he-JIT,TAILCALL)"
45+
)
4646

47-
assert message_sent[0].strip() == expected
47+
assert expected in message_sent[0].strip()

tests/test_workflow.py

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -239,51 +239,6 @@ def test_whole_workflow(tmpdir):
239239
"--check",
240240
]
241241
)
242-
with open("requirements.txt", "w") as fd:
243-
fd.write(f"{str(bench_runner_checkout)}\n")
244-
subprocess.check_call(
245-
[
246-
str(binary),
247-
"workflow_bootstrap.py",
248-
"python",
249-
"main",
250-
"linux-x86_64-linux",
251-
"deltablue",
252-
",,,",
253-
"--_fast",
254-
]
255-
)
256-
257-
258-
@pytest.mark.long_running
259-
def test_check_install_fail(tmpdir):
260-
repo = tmpdir / "repo"
261-
venv_dir = repo / "outer_venv"
262-
bench_runner_checkout = DATA_PATH.parents[1]
263-
if sys.platform.startswith("win"):
264-
binary = venv_dir / "Scripts" / "python.exe"
265-
else:
266-
binary = venv_dir / "bin" / "python"
267-
268-
repo.mkdir()
269-
270-
with contextlib.chdir(repo):
271-
subprocess.check_call([sys.executable, "-m", "venv", str(venv_dir)])
272-
subprocess.check_call(
273-
[
274-
str(binary),
275-
"-m",
276-
"pip",
277-
"install",
278-
"--upgrade",
279-
"pip",
280-
]
281-
)
282-
subprocess.check_call(
283-
[str(binary), "-m", "pip", "install", f"{bench_runner_checkout}[test]"]
284-
)
285-
subprocess.check_call([str(binary), "-m", "bench_runner", "install"])
286-
287242
# Now edit one of the generated files to make the check fail
288243
with open("workflow_bootstrap.py", "a") as fd:
289244
fd.write("# EXTRA CONTENT\n\n")
@@ -299,41 +254,6 @@ def test_check_install_fail(tmpdir):
299254
]
300255
)
301256

302-
303-
@pytest.mark.long_running
304-
@pytest.mark.skipif(not sys.platform.startswith("linux"), reason="Linux only")
305-
def test_linux_perf(tmpdir):
306-
"""
307-
Tests the whole workflow from a clean benchmarking repo.
308-
"""
309-
repo = tmpdir / "repo"
310-
venv_dir = repo / "outer_venv"
311-
bench_runner_checkout = DATA_PATH.parents[1]
312-
if sys.platform.startswith("win"):
313-
binary = venv_dir / "Scripts" / "python.exe"
314-
else:
315-
binary = venv_dir / "bin" / "python"
316-
profiling_dir = Path(repo / "profiling" / "results")
317-
318-
repo.mkdir()
319-
Path(profiling_dir).mkdir(parents=True)
320-
321-
with contextlib.chdir(repo):
322-
subprocess.check_call([sys.executable, "-m", "venv", str(venv_dir)])
323-
subprocess.check_call(
324-
[
325-
str(binary),
326-
"-m",
327-
"pip",
328-
"install",
329-
"--upgrade",
330-
"pip",
331-
]
332-
)
333-
subprocess.check_call(
334-
[str(binary), "-m", "pip", "install", f"{bench_runner_checkout}[test]"]
335-
)
336-
subprocess.check_call([str(binary), "-m", "bench_runner", "install"])
337257
with open("requirements.txt", "w") as fd:
338258
fd.write(f"{str(bench_runner_checkout)}\n")
339259
subprocess.check_call(
@@ -346,17 +266,5 @@ def test_linux_perf(tmpdir):
346266
"deltablue",
347267
",,,",
348268
"--_fast",
349-
"--perf",
350269
]
351270
)
352-
353-
csv_file = profiling_dir / "deltablue.perf.csv"
354-
assert csv_file.is_file()
355-
356-
with open(csv_file, "r") as fd:
357-
lines = iter(fd.readlines())
358-
first_line = next(lines)
359-
assert first_line.strip() == "self,pid,command,shared_obj,symbol"
360-
for line in fd.readlines():
361-
assert line.strip().endswith("_PyEval_EvalFrameDefault")
362-
break

0 commit comments

Comments
 (0)