From 5825b3c191b4c905ee6ec671fa71e8fe5127f834 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:13:48 +0100 Subject: [PATCH] chore(ci): make logging file available after e2e test (DEV-3436) (#887) --- .github/workflows/tests-on-push.yml | 7 +++++++ src/dsp_tools/utils/logger_config.py | 2 +- test/e2e/conftest.py | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/e2e/conftest.py diff --git a/.github/workflows/tests-on-push.yml b/.github/workflows/tests-on-push.yml index b8864174d..5a1ba3e77 100644 --- a/.github/workflows/tests-on-push.yml +++ b/.github/workflows/tests-on-push.yml @@ -91,6 +91,13 @@ jobs: run: poetry exec e2e-tests - name: stop stack # see if this command can run (it isn't tested anywhere else) run: poetry run dsp-tools stop-stack + - name: make logging file available + uses: actions/upload-artifact@v4 + if: always() + with: + name: logging.log + path: /home/runner/.dsp-tools/logging.log + compression-level: 0 distribution: diff --git a/src/dsp_tools/utils/logger_config.py b/src/dsp_tools/utils/logger_config.py index e7049c7dc..dd9eeb714 100644 --- a/src/dsp_tools/utils/logger_config.py +++ b/src/dsp_tools/utils/logger_config.py @@ -20,7 +20,7 @@ def logger_config() -> None: text_format = "{time:YYYY-MM-DD HH:mm:ss.SSS} | {level: <8} | {message}" rotation_size = "100 MB" retention_number = 30 - timestamp_str = datetime.now().strftime("%Y%m%d-%H%M") + timestamp_str = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") logger.add( sink=logger_savepath, diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py new file mode 100644 index 000000000..e28dc796b --- /dev/null +++ b/test/e2e/conftest.py @@ -0,0 +1,10 @@ +from dsp_tools.utils.logger_config import logger_config + + +def pytest_sessionstart() -> None: + """ + Called after the Session object has been created + and before performing collection and entering the run test loop. + See https://docs.pytest.org/en/latest/reference/reference.html#pytest.hookspec.pytest_sessionstart. + """ + logger_config()