Skip to content

Commit dde9ebc

Browse files
Merge pull request #33 from ValentinBoudevin/feature/fix-tests
tests: fixed CQFD testing.
2 parents 1a9cae0 + c7c7896 commit dde9ebc

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

.cqfd/docker/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1414

1515
COPY requirements/dev.txt /tmp/dev.txt
1616

17+
RUN mkdir -p /cache/vulnscout && chmod -R 777 /cache
18+
1719
RUN pip install --no-cache-dir -r /tmp/dev.txt \
1820
&& rm -rf /tmp/dev.txt

tests/Makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1+
MAKEFILE_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
2+
SRC_DIR := $(MAKEFILE_DIR)../src
3+
FRONTEND_DIR := $(MAKEFILE_DIR)../frontend
14

25
test: test_backend test_frontend
36

47
test_backend:
5-
flake8 ../src
6-
mypy --config-file tox.ini ../src
7-
pytest --cov-report html --cov=../src
8-
pdoc ../src -o ./htmldocs
8+
flake8 $(SRC_DIR)
9+
mypy --config-file tox.ini $(SRC_DIR)
10+
pytest --cov-report html --cov=$(SRC_DIR)
11+
pdoc $(SRC_DIR) -o ./htmldocs
912
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
1013

1114
test_frontend:
12-
cd ../frontend && \
15+
cd $(FRONTEND_DIR) && \
1316
npm ci --include=dev && \
1417
npm test
1518

1619
jenkins_test: jenkins_test_backend jenkins_test_frontend
1720

1821
jenkins_test_backend:
19-
flake8
20-
pytest --cov=src --junitxml=./junit_backend.xml
21-
pdoc ./src -o ./htmldocs
22+
flake8 $(SRC_DIR)
23+
pytest --cov=$(SRC_DIR) --junitxml=./junit_backend.xml
24+
pdoc $(SRC_DIR) -o ./htmldocs
2225
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
2326

2427
jenkins_test_frontend:
25-
cd frontend && \
28+
cd $(FRONTEND_DIR) && \
2629
npm ci --include=dev && \
2730
npm test -- --runInBand
2831

tests/end_to_end_tests/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ def write_demo_files(files):
1010
"""Write files with an real-life example issued fron cairo vulnerability."""
1111

1212
if "CDX_PATH" in files:
13-
with open("tests/end_to_end_tests/input_cdx.json", "r") as f:
13+
with open("end_to_end_tests/input_cdx.json", "r") as f:
1414
files["CDX_PATH"].write_text(f.read())
1515

1616
if "SPDX_PATH" in files:
17-
with open("tests/end_to_end_tests/input_spdx.json", "r") as f:
17+
with open("end_to_end_tests/input_spdx.json", "r") as f:
1818
files["SPDX_PATH"].write_text(f.read())
1919

2020
if "GRYPE_CDX_PATH" in files:
21-
with open("tests/end_to_end_tests/grype_cdx.json", "r") as f:
21+
with open("end_to_end_tests/grype_cdx.json", "r") as f:
2222
files["GRYPE_CDX_PATH"].write_text(f.read())
2323

2424
if "GRYPE_SPDX_PATH" in files:
25-
with open("tests/end_to_end_tests/grype_spdx.json", "r") as f:
25+
with open("end_to_end_tests/grype_spdx.json", "r") as f:
2626
files["GRYPE_SPDX_PATH"].write_text(f.read())
2727

2828
if "YOCTO_CVE_CHECKER" in files:
29-
with open("tests/end_to_end_tests/yocto.json", "r") as f:
29+
with open("end_to_end_tests/yocto.json", "r") as f:
3030
files["YOCTO_CVE_CHECKER"].write_text(f.read())
3131

3232
if "TIME_ESTIMATES_PATH" in files:
33-
with open("tests/end_to_end_tests/time_estimates.json", "r") as f:
33+
with open("end_to_end_tests/time_estimates.json", "r") as f:
3434
files["TIME_ESTIMATES_PATH"].write_text(f.read())
3535

3636
return files

tests/spdx_merge/test_merge_spdx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@pytest.fixture
1212
def setup(tmp_path):
13-
os.environ["INPUT_SPDX_FOLDER"] = "tests/spdx_merge/data"
13+
os.environ["INPUT_SPDX_FOLDER"] = "spdx_merge/data"
1414
os.environ["OUTPUT_SPDX_FILE"] = str(tmp_path / "output.spdx.json")
1515

1616

0 commit comments

Comments
 (0)