Skip to content

Commit 5e9a288

Browse files
committed
fix/powershell
1 parent 6d4cac7 commit 5e9a288

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

service/app/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import os
21

32
# write your code.
4-
print("Hello World!")
5-
print("abspath:", os.path.abspath(__file__))
3+
def run():
4+
print("Hello World!")
5+
6+
if __name__ == "__main__":
7+
run()

service/pytest.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
[pytest]
2-
testpaths = /tests
2+
testpaths = tests
33
addopts =
44
-q
5-
--cov=.
5+
--cov=app
66
--cov-branch
77
--cov-report=term-missing:skip-covered
88
--cov-report=xml:/reports/ci/coverage.xml
99
--cov-report=html:/reports/ci/html
1010
--cov-fail-under=80
1111
python_files = test_*.py
12-
asyncio_mode = auto
13-
asyncio_default_fixture_loop_scope = function

service/tests/test_main.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
import csv
22
import os
3-
import subprocess
4-
import sys
53

4+
from app.main import run
65

7-
def test_main_script_output():
8-
result = subprocess.run(
9-
[sys.executable, os.path.join(os.path.dirname(__file__), "..","app", "main.py")],
10-
capture_output=True,
11-
text=True,
12-
check=True
13-
)
14-
output = result.stdout
6+
7+
def test_run(capfd):
8+
run()
9+
output, _ = capfd.readouterr()
1510
assert "Hello World!" in output
16-
assert "abspath:" in output
1711

1812

1913
def test_sample_csv_content():

0 commit comments

Comments
 (0)