master > master: code - makefiles korrigiert + unittest

This commit is contained in:
RD 2022-04-18 19:03:01 +02:00
parent d5a79e77ce
commit dc831a91c7
2 changed files with 14 additions and 12 deletions

View File

@ -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)
################################

View File

@ -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