Skip to content

Commit

Permalink
add docs on how to run tests, use sys.executable instead of "python"
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Mar 23, 2024
1 parent 5f90621 commit 743d264
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ Suggested code hygiene:
$ ruff --show-fixes --show-source .
$ black .
```

## Running tests locally

```sh
python3 -m pip install pytest yamlish junit_xml
python3 -m pytest
```
3 changes: 2 additions & 1 deletion test/_prepare_outputs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import glob
import os
import subprocess
import sys

from _common import normalize_output

Expand All @@ -9,7 +10,7 @@
output = f"test/output/{name}.xml"
try:
run = subprocess.run(
["python", "-m", "tap2junit", "-i", file, "-o", output],
[sys.executable, "-m", "tap2junit", "-i", file, "-o", output],
shell=False,
)
run.check_returncode()
Expand Down
3 changes: 2 additions & 1 deletion test/test_outputs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import glob
import os
import subprocess
import sys
from pathlib import Path

import pytest
Expand All @@ -16,5 +17,5 @@ def test_file(self, tmp_path, file):
name = os.path.basename(file).replace(".tap", "")
original = f"./test/output/{name}.xml"
output = f"{tmp_path}/out.xml"
subprocess.run(["python", "-m", "tap2junit", "-i", file, "-o", output])
subprocess.run([sys.executable, "-m", "tap2junit", "-i", file, "-o", output])
assert Path(original).read_text() == normalize_output(Path(output).read_text())

0 comments on commit 743d264

Please sign in to comment.