From dc831a91c7619bab49ef448d9288a58c719cda56 Mon Sep 17 00:00:00 2001 From: raj_mathe Date: Mon, 18 Apr 2022 19:03:01 +0200 Subject: [PATCH] master > master: code - makefiles korrigiert + unittest --- code/python/Makefile | 20 +++++++++++--------- code/rust/Makefile | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/code/python/Makefile b/code/python/Makefile index e9c4822..9726919 100644 --- a/code/python/Makefile +++ b/code/python/Makefile @@ -21,12 +21,12 @@ endif # Macros ################################ -define create_folder_if_not_exists - @if ! [ -d "$(1)" ]; then mkdir "$(1)"; fi +define create_file_if_not_exists + @touch "$(1)"; endef define create_folder_if_not_exists - @touch "$(1)"; + if ! [ -d "$(1)" ]; then mkdir "$(1)"; fi endef define delete_if_file_exists @@ -63,13 +63,15 @@ all: setup run ################################ # TARGETS: testing ################################ -unit-test: unit-tests +tests: unit-tests unit-tests: - @cd tests && \ - ${PYTHON} -m unittest discover -v \ - --start-directory "." \ - --top-level-directory ".." \ - --pattern "test_*.py" + @# For logging purposes (since stdout is rechanneled): + @$(call delete_if_file_exists,logs/debug.log) + @$(call create_folder_if_not_exists,logs) + @$(call create_file_if_not_exists,logs/debug.log) + @# for python unit tests: + @${PYTHON} -m pytest tests --cache-clear --verbose -k test_ + @cat logs/debug.log ################################ # AUXILIARY (INTERNAL TARGETS) ################################ diff --git a/code/rust/Makefile b/code/rust/Makefile index 41365d7..6586695 100644 --- a/code/rust/Makefile +++ b/code/rust/Makefile @@ -19,12 +19,12 @@ endif # Macros ################################ -define create_folder_if_not_exists - @if ! [ -d "$(1)" ]; then mkdir "$(1)"; fi +define create_file_if_not_exists + @touch "$(1)"; endef define create_folder_if_not_exists - @touch "$(1)"; + @if ! [ -d "$(1)" ]; then mkdir "$(1)"; fi endef define delete_if_file_exists