Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test: ## Run tests in a Docker container

test-force: ## Run tests in a Docker container while ignoring any stored state
@docker volume rm codesectools_pytest-cache 2>&1 1>/dev/null || true
@docker volume rm codesectools_cstools-cache 2>&1 1>/dev/null || true
@docker compose build 1>/dev/null
@docker compose run --rm no-sast
@docker compose run --rm with-sast
Expand Down
4 changes: 2 additions & 2 deletions codesectools/sasts/core/sast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def save_results(self, project_dir: Path, output_dir: Path, extra: dict) -> None
filepath = project_dir / parent_dir / filename
if filepath.is_file():
if not filepath == output_dir / filename:
filepath.rename(output_dir / filename)
shutil.move(filepath, output_dir / filename)
else:
if required:
missing_files.append(filename)
Expand All @@ -189,7 +189,7 @@ def save_results(self, project_dir: Path, output_dir: Path, extra: dict) -> None
if filepaths:
for filepath in filepaths:
if not filepath == output_dir / filename:
filepath.rename(output_dir / filepath.name)
shutil.move(filepath, output_dir / filepath.name)
else:
if required:
missing_files.append(filename)
Expand Down
7 changes: 5 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:

volumes:
- pytest-cache:/app/.pytest_cache
- cstools-cache:/root/.codesectools/cache

environment:
_TYPER_STANDARD_TRACEBACK: 1
Expand All @@ -27,9 +28,11 @@ services:

volumes:
- pytest-cache:/app/.pytest_cache

- cstools-cache:/root/.codesectools/cache

environment:
_TYPER_STANDARD_TRACEBACK: 1

volumes:
pytest-cache:
pytest-cache:
cstools-cache:
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "CodeSecTools"
version = "0.13.2"
version = "0.13.3"
description = "A framework for code security that provides abstractions for static analysis tools and datasets to support their integration, testing, and evaluation."
readme = "README.md"
license = "AGPL-3.0-only"
Expand Down
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import json
import logging
import os
import shutil
from pathlib import Path
from types import GeneratorType

import pytest

from codesectools.utils import USER_CACHE_DIR

# Fix: I/O operation on closed (https://github.com/pallets/click/issues/824)
logging.getLogger("matplotlib").setLevel(logging.ERROR)

Expand Down Expand Up @@ -55,6 +58,13 @@ def pytest_sessionstart(session: pytest.Session) -> None:

Skips the entire test session if no source files have changed.
"""
if USER_CACHE_DIR.is_dir():
for child in USER_CACHE_DIR.iterdir():
if child.is_file():
child.unlink()
elif child.is_dir():
shutil.rmtree(child)

if not source_code_changed():
pytest.exit("No changes in source code, skipping test session.", returncode=0)

Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.