Skip to content

Commit 6bb9538

Browse files
committed
Use makefile for running tests and lints
1 parent 979abed commit 6bb9538

5 files changed

Lines changed: 35 additions & 10 deletions

File tree

‎.github/workflows/codemod_pygoat.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
- name: Run Codemodder
3939
run: codemodder --output output.codetf pygoat
4040
- name: Check PyGoat Findings
41-
run: pytest -v ci_tests/test_webgoat_findings.py
41+
run: make webgoat-test

‎.github/workflows/lint.yml‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Black Format Check
3434
run: black --check .
3535
- name: Run pylint
36-
run: pylint codemodder/ tests/ integration_tests/ -v
36+
run: make lint
3737

3838
complexity:
3939
name: Code Complexity
@@ -50,10 +50,8 @@ jobs:
5050
run: |
5151
pip install -r requirements/complexity.txt
5252
- name: Run Radon
53-
run: |
54-
radon cc codemodder --min A --total-average
53+
run: make radon
5554
- name: Run Xenon
56-
run: |
57-
# threshold for pipeline to fail if we go below average, module, or block complexity
58-
# https://github.com/rubik/xenon
59-
xenon codemodder --max-average A --max-modules C --max-absolute C
55+
# threshold for pipeline to fail if we go below average, module, or block complexity
56+
# https://github.com/rubik/xenon
57+
run: make xenon

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
- name: Install Dependencies
3535
run: pip install -r requirements/test.txt
3636
- name: Run unit tests
37-
run: pytest -v --cov-fail-under=95 --cov=codemodder tests --numprocesses auto
37+
run: make test
3838
- name: Run integration tests
39-
run: pytest -v integration_tests
39+
run: make integration-test
4040
- name: Upload coverage reports to Codecov
4141
uses: codecov/codecov-action@v3
4242
env:

‎Makefile‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
PYTEST = pytest -v
2+
COV_FLAGS = --cov-fail-under=95 --cov=codemodder
3+
XDIST_FLAGS = --numprocesses auto
4+
5+
test:
6+
${PYTEST} ${COV_FLAGS} tests ${XDIST_FLAGS}
7+
8+
integration-test:
9+
${PYTEST} integration_tests
10+
11+
webgoat-test:
12+
${PYTEST} -v ci_tests/test_webgoat_findings.py
13+
14+
lint:
15+
pylint -v codemodder tests integration_tests
16+
17+
radon:
18+
radon cc codemodder --min A --total-average
19+
20+
# threshold for pipeline to fail if we go below average, module, or block complexity
21+
# https://github.com/rubik/xenon
22+
xenon:
23+
xenon codemodder --max-average A --max-modules C --max-absolute C

‎pyproject.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ codemodder = "codemodder.__main__:main"
2323

2424
[tool.setuptools.package-data]
2525
"codemodder.codemods.semgrep" = ["src/codemodder/codemods/semgrep/*.yaml"]
26+
27+
[tool.pytest.ini_options]
28+
# Ignore integration tests and ci tests by default
29+
testpaths = ["tests"]

0 commit comments

Comments
 (0)