From 2340ee5bfb6e44e1ec158409962478ee6dbd3007 Mon Sep 17 00:00:00 2001 From: Michael Genson <71845777+michael-genson@users.noreply.github.com> Date: Sat, 28 Jan 2023 18:49:09 -0600 Subject: [PATCH] Dev Improvements (#2058) * added ruff cache to git ignore * moved venv to project and added interpreter path * added dummy method to LDAP test * removed unused setting --- .devcontainer/Dockerfile | 3 ++- .gitignore | 1 + .vscode/settings.json | 35 ++++++++++++++++++++++++------- tests/unit_tests/test_security.py | 3 +++ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 68915a503df9..4d8b27e370d6 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -20,7 +20,8 @@ ENV PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=off \ PIP_DISABLE_PIP_VERSION_CHECK=on \ PIP_DEFAULT_TIMEOUT=100 \ - POETRY_HOME="/opt/poetry" + POETRY_HOME="/opt/poetry" \ + POETRY_VIRTUALENVS_IN_PROJECT=true # prepend poetry and venv to path ENV PATH="$POETRY_HOME/bin:$PATH" diff --git a/.gitignore b/.gitignore index 164c8186f470..f819dd37b9db 100644 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,7 @@ coverage.xml *.cover .hypothesis/ .pytest_cache/ +.ruff_cache/ test.db # Translations diff --git a/.vscode/settings.json b/.vscode/settings.json index 2f9a9f96c7e2..29d0b6f895bb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,9 @@ { - "cSpell.enableFiletypes": ["!javascript", "!python", "!yaml"], + "cSpell.enableFiletypes": [ + "!javascript", + "!python", + "!yaml" + ], "cSpell.words": [ "chowdown", "compression", @@ -14,7 +18,9 @@ "source.organizeImports": false }, "editor.formatOnSave": true, - "eslint.workingDirectories": ["./frontend"], + "eslint.workingDirectories": [ + "./frontend" + ], "files.exclude": { "**/__pycache__": true, "**/.DS_Store": true, @@ -23,24 +29,39 @@ "**/.svn": true, "**/CVS": true }, - "i18n-ally.enabledFrameworks": ["vue"], + "i18n-ally.enabledFrameworks": [ + "vue" + ], "i18n-ally.keystyle": "nested", "i18n-ally.localesPaths": "frontend/lang/messages", "i18n-ally.sourceLanguage": "en-US", + "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", "python.formatting.provider": "black", "python.linting.enabled": true, "python.linting.flake8Enabled": false, "python.linting.pylintEnabled": false, - "python.linting.pylintArgs": ["--rcfile=${workspaceFolder}/.pylintrc"], + "python.linting.pylintArgs": [ + "--rcfile=${workspaceFolder}/.pylintrc" + ], "python.testing.autoTestDiscoverOnSaveEnabled": false, - "python.testing.pytestArgs": ["tests"], + "python.testing.pytestArgs": [ + "tests" + ], "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, "python.analysis.typeCheckingMode": "off", "python.linting.mypyEnabled": true, - "isort.path": ["${workspaceFolder}/.venv/bin/isort"], + "isort.path": [ + "${workspaceFolder}/.venv/bin/isort" + ], "search.mode": "reuseEditor", - "python.testing.unittestArgs": ["-v", "-s", "./tests", "-p", "test_*.py"], + "python.testing.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test_*.py" + ], "explorer.fileNesting.enabled": true, "explorer.fileNesting.patterns": { "package.json": "package-lock.json, yarn.lock, .eslintrc.js, tsconfig.json, .prettierrc, .editorconfig", diff --git a/tests/unit_tests/test_security.py b/tests/unit_tests/test_security.py index 0fb3de04fbfa..4bf6757dbdab 100644 --- a/tests/unit_tests/test_security.py +++ b/tests/unit_tests/test_security.py @@ -40,6 +40,9 @@ def test_ldap_authentication_mocked(monkeypatch: MonkeyPatch): assert scope == ldap.SCOPE_SUBTREE return [()] + def set_option(*args, **kwargs): + pass + def ldap_initialize_mock(url): assert url == "" return LdapConnMock()