Skip to content

Commit 3b101ac

Browse files
committed
feat(tests): update Makefile and GitHub Actions to use Poetry for test execution and coverage
1 parent d2c2c59 commit 3b101ac

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

.github/workflows/pr-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
3030
- name: Run Tests (by Makefile)
3131
run: |
32-
make test
32+
poetry run make test
3333
3434
- name: Combine Coverage Report (XML)
3535
run: |

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
CHAPTERS = ch01 ch04 ch06 ch07
44
TEST_RESULTS_DIR = test-results
55

6+
# Poetry 환경 강제
7+
POETRY ?= poetry run
8+
69
test: test-all
710

811
clean: clean-results clean-coverage
@@ -14,39 +17,39 @@ clean-results:
1417
rm -rf $(TEST_RESULTS_DIR)
1518

1619
clean-coverage:
17-
coverage erase
20+
$(POETRY) coverage erase
1821
rm -f $(TEST_RESULTS_DIR)/.coverage*
1922

2023
test-all: clean-results clean-coverage $(TEST_RESULTS_DIR) test-ch01 test-ch04 test-ch06 test-ch07 combine-coverage merge-junit
2124

2225
test-ch01:
2326
cd chapter01 && \
24-
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch01 coverage run -m pytest -v \
27+
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch01 $(POETRY) coverage run -m pytest -v \
2528
--junitxml=../$(TEST_RESULTS_DIR)/ch01-results.xml
2629

2730
test-ch04:
2831
cd chapter04 && \
29-
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch04 coverage run -m pytest -v \
32+
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch04 $(POETRY) coverage run -m pytest -v \
3033
--junitxml=../$(TEST_RESULTS_DIR)/ch04-results.xml
3134

3235
test-ch06:
3336
cd chapter06 && \
34-
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch06 coverage run -m pytest -v \
37+
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch06 $(POETRY) coverage run -m pytest -v \
3538
--junitxml=../$(TEST_RESULTS_DIR)/ch06-results.xml
3639

3740
test-ch07:
3841
cd chapter07 && \
39-
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch07 coverage run -m pytest -v \
42+
COVERAGE_FILE=../$(TEST_RESULTS_DIR)/.coverage.ch07 $(POETRY) coverage run -m pytest -v \
4043
--junitxml=../$(TEST_RESULTS_DIR)/ch07-results.xml
4144

4245
combine-coverage:
43-
coverage combine $(TEST_RESULTS_DIR)
44-
coverage report
45-
coverage html
46+
$(POETRY) coverage combine $(TEST_RESULTS_DIR)
47+
$(POETRY) coverage report
48+
$(POETRY) coverage html
4649

4750
merge-junit:
48-
command -v python3 > /dev/null && python3 -m pip show junitparser > /dev/null || python3 -m pip install junitparser
49-
python3 -m junitparser merge \
51+
$(POETRY) python -m pip show junitparser > /dev/null || $(POETRY) python -m pip install junitparser
52+
$(POETRY) python -m junitparser merge \
5053
$(TEST_RESULTS_DIR)/ch01-results.xml \
5154
$(TEST_RESULTS_DIR)/ch04-results.xml \
5255
$(TEST_RESULTS_DIR)/ch06-results.xml \

0 commit comments

Comments
 (0)