From 17e90c3787ec7fbfa687dc4ecb55389e27e4cf5c Mon Sep 17 00:00:00 2001 From: John Rofrano Date: Tue, 3 Oct 2023 03:17:56 +0000 Subject: [PATCH 1/2] Switched from green to pytest --- .github/workflows/ci.yml | 2 +- Makefile | 2 +- requirements.txt | 25 ++++++++++++++----------- setup.cfg | 14 +++++++------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7135f7..199e78c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: - name: Run unit tests with green run: | export FLASK_APP=service:app - green + pytest --disable-warnings env: DATABASE_URI: "postgresql://postgres:pgs3cr3t@postgres:5432/testdb" diff --git a/Makefile b/Makefile index 2d823e4..96c4716 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ lint: ## Run the linter test: ## Run the unit tests $(info Running tests...) - green -vvv --processes=1 --run-coverage --termcolor --minimum-coverage=95 + pytest --disable-warnings ##@ Runtime diff --git a/requirements.txt b/requirements.txt index 3702c94..4fc4af9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,26 +1,29 @@ # Pinned dependencies that cause breakage -Werkzeug==2.3.3 +Werkzeug==2.3.7 SQLAlchemy==2.0.0 # Runtime dependencies -Flask==2.3.2 +Flask==2.3.3 Flask-SQLAlchemy==3.0.2 psycopg2==2.9.5 -python-dotenv==0.21.1 +python-dotenv==1.0.0 # Runtime tools -gunicorn==20.1.0 +gunicorn==21.2.0 honcho==1.1.0 # Code quality -pylint==2.16.2 -flake8==6.0.0 -black==23.1.0 +pylint==2.17.5 +flake8==6.1.0 +black==23.7.0 # Testing dependencies -green==3.4.3 -factory-boy==3.2.1 -coverage==7.1.0 +pytest==7.4.0 +pytest-pspec==0.0.4 +pytest-cov==4.1.0 + +factory-boy==3.3.0 +coverage==7.3.0 # Utilities -httpie==3.2.1 +httpie==3.2.2 diff --git a/setup.cfg b/setup.cfg index ab0ef5e..81a5e99 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,10 @@ -[green] -verbose=3 -processes=1 -run-coverage=1 -termcolor=1 -minimum-coverage=95 -junit-report=./unittests.xml +# setup configuration for tools +[tool:pytest] +minversion = 6.0 +addopts = --pspec --cov=service --disable-warnings +testpaths = + tests + integration [flake8] max-line-length = 127 From 2c088a84b0d550ffd2c4dde3ffae912dd6c6d8be Mon Sep 17 00:00:00 2001 From: John Rofrano Date: Tue, 3 Oct 2023 03:18:12 +0000 Subject: [PATCH 2/2] Updated development dependencies --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 19 +++++++++++++++++-- .vscode/settings.json | 15 ++------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f254ba7..792f958 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM rofrano/nyu-devops-base:su23 +FROM rofrano/nyu-devops-base:fa23 # Add Python package requiremnets to the dev environment WORKDIR /app diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 48acce4..21c4408 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,12 +7,27 @@ "remoteUser": "vscode", "customizations": { "vscode": { + "settings": { + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true + }, + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "markdown-preview-github-styles.colorTheme": "light", + "files.exclude": { + "**/.git": true, + "**/.DS_Store": true, + "**/*.pyc": true, + "**/__pycache__": true, + "**/.pytest_cache": true + } + }, "extensions": [ "VisualStudioExptTeam.vscodeintellicode", "ms-python.python", "ms-python.pylint", "ms-python.vscode-pylance", - "alexkrechik.cucumberautocomplete", "cstrap.flask-snippets", "yzhang.markdown-all-in-one", "bierner.github-markdown-preview", @@ -31,7 +46,7 @@ "bbenoist.vagrant" ] } - }, + } //"forwardPorts": [8000], // "postCreateCommand": "" } diff --git a/.vscode/settings.json b/.vscode/settings.json index 3bb902d..ed49147 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,9 +3,7 @@ "makefile.extensionOutputFolder": "./.vscode", "git.mergeEditor": true, "python.pythonPath": "/usr/local/bin/python", - "python.linting.enabled": true, - "python.linting.pylintEnabled": true, - "python.testing.pytestEnabled": false, + "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": true, "python.testing.unittestArgs": [ "-v", @@ -13,14 +11,5 @@ "./tests", "-p", "test*.py" - ], - "files.exclude": { - "**/.git": true, - "**/.svn": true, - "**/.hg": true, - "**/CVS": true, - "**/.DS_Store": true, - "**/*.pyc": true, - "**/__pycache__": true - } + ] }