Skip to content

Commit

Permalink
refactor: moves docker makefile into docker folder.
Browse files Browse the repository at this point in the history
Refs: #211.
  • Loading branch information
Artanias authored Jan 4, 2025
1 parent f1323ba commit e22f5d7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,5 @@ help-general:
.EXPORT_ALL_VARIABLES:
.PHONY: all test man

include docker.mk
include docker/docker.mk
include locales/i18n.mk
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/test_ubuntu2204.dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ADD README.md /usr/src/@UTIL_NAME@/README.md
ADD LICENSE /usr/src/@UTIL_NAME@/LICENSE
ADD Makefile /usr/src/@UTIL_NAME@/Makefile
ADD locales/ /usr/src/@UTIL_NAME@/locales
ADD docker.mk /usr/src/@UTIL_NAME@/docker.mk
ADD docker/docker.mk /usr/src/@UTIL_NAME@/docker/docker.mk
ADD debian/ /usr/src/@UTIL_NAME@/debian

CMD make test
2 changes: 1 addition & 1 deletion docker/ubuntu2204.dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ADD README.md /usr/src/@UTIL_NAME@/README.md
ADD LICENSE /usr/src/@UTIL_NAME@/LICENSE
ADD Makefile /usr/src/@UTIL_NAME@/Makefile
ADD locales/i18n.mk /usr/src/@UTIL_NAME@/locales/i18n.mk
ADD docker.mk /usr/src/@UTIL_NAME@/docker.mk
ADD docker/docker.mk /usr/src/@UTIL_NAME@/docker/docker.mk
ADD @DEBIAN_PACKAGES_PATH@ /usr/src/@UTIL_NAME@/@DEBIAN_PACKAGES_PATH@

RUN apt-get install -y /usr/src/@UTIL_NAME@/@DEBIAN_PACKAGES_PATH@/@[email protected]
Expand Down
22 changes: 14 additions & 8 deletions test/auto/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,32 @@

@pytest.fixture
def create_reports_folder():
with suppress(Exception):
os.mkdir(REPORTS_FOLDER)
assert os.path.exists(REPORTS_FOLDER)
__create_reports_folder()

yield

shutil.rmtree(REPORTS_FOLDER)
__remove_reports_folder()


@pytest.fixture(scope="module")
def create_reports_folder_module():
with suppress(Exception):
os.mkdir(REPORTS_FOLDER)
assert os.path.exists(REPORTS_FOLDER)
__create_reports_folder()

yield

shutil.rmtree(REPORTS_FOLDER)
__remove_reports_folder()


@pytest.fixture(scope="session", autouse=True)
def set_logging_level():
modify_settings(log_level="debug")


def __create_reports_folder() -> None:
with suppress(Exception):
os.mkdir(REPORTS_FOLDER)
assert os.path.exists(REPORTS_FOLDER)


def __remove_reports_folder() -> None:
shutil.rmtree(REPORTS_FOLDER)
4 changes: 2 additions & 2 deletions test/auto/functional/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_compare_cpp_files(cmd: list[str], out: bytes, found_plag: bool):
result = run_check(cmd, extension="cpp")

if found_plag:
result.assert_found_plagiarism()
result.assert_found_similarity()
else:
result.assert_success()
assert out in result.cmd_res.stdout
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_compare_py_files(cmd: list[str], out: bytes, found_plag: bool):
result = run_check(cmd)

if found_plag:
result.assert_found_plagiarism()
result.assert_found_similarity()
else:
result.assert_success()
assert out in result.cmd_res.stdout
Expand Down
2 changes: 1 addition & 1 deletion test/auto/functional/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setup(create_reports_folder_module: None):
modify_settings(
reports=REPORTS_FOLDER, reports_extension="csv", short_output=1
).assert_success()
run_check(["--directories", "test/unit/codeplag/cplag", "src/"]).assert_found_plagiarism()
run_check(["--directories", "test/unit/codeplag/cplag", "src/"]).assert_found_similarity()

yield

Expand Down
2 changes: 1 addition & 1 deletion test/auto/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def assert_success(self: Self) -> None:
def assert_failed(self: Self) -> None:
assert self.cmd_res.returncode, str(self.cmd_res)

def assert_found_plagiarism(self: Self) -> None:
def assert_found_similarity(self: Self) -> None:
assert self.cmd_res.returncode == ExitCode.EXIT_FOUND_SIM, str(self.cmd_res)


Expand Down

0 comments on commit e22f5d7

Please sign in to comment.