From 37156bb94501e2eed82f06c78e369513a6b53795 Mon Sep 17 00:00:00 2001 From: Johannes Zumthurm <nimro27@gmx.net> Date: Sat, 16 Nov 2024 20:37:44 +0100 Subject: [PATCH] cleanup ci --- .gitlab-ci.yml | 9 ++++++--- amivapi/bootstrap.py | 2 -- tox.ini | 2 +- wait_for_mongodb.py | 26 -------------------------- 4 files changed, 7 insertions(+), 32 deletions(-) delete mode 100644 wait_for_mongodb.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aee2999e..2506af3b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,17 @@ +stages: + - test + # - build + # - deploy + test: + stage: test image: python:3.12 services: - name: mongo:5.0.14 alias: mongodb - variables: - AMIVAPI_CONFIG: /amivapi/tests/config.py before_script: - pip install --upgrade pip - pip install tox - - python wait_for_mongodb.py script: - tox artifacts: diff --git a/amivapi/bootstrap.py b/amivapi/bootstrap.py index b744a301..ebcd37a5 100644 --- a/amivapi/bootstrap.py +++ b/amivapi/bootstrap.py @@ -75,7 +75,6 @@ def create_app(config_file=None, **kwargs): # Specified path > environment var > default path; abspath for better log user_config = abspath(config_file or getenv('AMIVAPI_CONFIG', 'config.py')) - my_info = 'This is the user_config path: ' + user_config try: config.from_pyfile(user_config) config_status = "Config loaded: %s" % user_config @@ -92,7 +91,6 @@ def create_app(config_file=None, **kwargs): validator=ValidatorAMIV) app.logger.setLevel(app.config.get('LOG_LEVEL') or logging.INFO) app.logger.info(config_status) - app.logger.info(my_info) # Set up error logging with sentry init_sentry(app) diff --git a/tox.ini b/tox.ini index 0f42a65f..5528226d 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ python = [testenv] # `-rs` shows summary on skipped tests by default commands = - py.test --cov-report term-missing --cov-report xml:coverage.xml --cov=amivapi -rs {posargs} amivapi/tests/users/test_users.py + py.test --cov-report term-missing --cov-report xml:coverage.xml --cov=amivapi -rs {posargs} amivapi/tests install_command = pip install {opts} {packages} deps = -r requirements.txt diff --git a/wait_for_mongodb.py b/wait_for_mongodb.py deleted file mode 100644 index f8b0b6a2..00000000 --- a/wait_for_mongodb.py +++ /dev/null @@ -1,26 +0,0 @@ -# wait_for_mongodb.py -import os -import socket -import time - -def wait_for_mongodb(host='mongodb', port=27017): - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - while True: - try: - s.connect((host, port)) - s.close() - print("MongoDB is reachable on port 27017") - break - except socket.error: - print("Waiting for MongoDB on port 27017...") - time.sleep(1) - -def print_working_directory(): - print("Current working directory:", os.getcwd()) - print("Files in the working directory:") - for filename in os.listdir(os.getcwd()): - print("-", filename) - -if __name__ == "__main__": - print_working_directory() - wait_for_mongodb() -- GitLab