From 19be438540f5c80b6e4cb4cea95f3846c97c25c0 Mon Sep 17 00:00:00 2001 From: Nathan Levesque Date: Thu, 21 Sep 2023 13:50:16 -0400 Subject: [PATCH] Removed runtime.txt and fixed poetry.lock --- .github/workflows/ci.yml | 28 ++++++++---------- poetry.lock | 64 +++++++++++++++++++++++++--------------- pylintrc | 1 + pyproject.toml | 48 ++++++++++++++++++++++-------- pytest.ini | 3 -- pytest_minimal.ini | 3 -- runtime.txt | 1 - tox.ini | 8 ++--- 8 files changed, 93 insertions(+), 63 deletions(-) delete mode 100644 pytest.ini delete mode 100644 pytest_minimal.ini delete mode 100644 runtime.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8c0031014..2a3f0bf9f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,30 +48,26 @@ jobs: run: cat Aptfile | sudo xargs apt-get install - name: Install poetry - uses: snok/install-poetry@v1 - with: - version: 1.5.1 - virtualenvs-create: true - virtualenvs-in-project: true + uses: snok/install-poetry@v1 + with: + version: 1.5.1 + virtualenvs-create: true + virtualenvs-in-project: true - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: "3.9.1" + python-version: "3.9.17" + cache: "poetry" - - id: cache - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/test_reqirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + - name: Poetry lock check + run: poetry lock --check - name: Install dependencies run: poetry install --no-interaction - name: Lint - run: pylint ./**/*.py + run: poetry run pylint ./**/*.py # You must also add the Configure sysctl limits step, otherwise Opensearch will not be able to boot. - name: Configure sysctl limits @@ -91,7 +87,7 @@ jobs: export MEDIA_ROOT="$(mktemp -d)" sudo mkdir /var/media sudo chown -R $USER:$USER /var/media - tox + poetry run tox env: DEBUG: 'False' NODE_ENV: 'production' diff --git a/poetry.lock b/poetry.lock index 21f5200159..df973f362e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. [[package]] name = "amqp" @@ -1073,6 +1073,20 @@ files = [ [package.extras] tests = ["asttokens", "littleutils", "pytest", "rich"] +[[package]] +name = "factory-boy" +version = "2.12.0" +description = "A versatile test fixtures replacement based on thoughtbot's factory_bot for Ruby." +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "factory_boy-2.12.0-py2.py3-none-any.whl", hash = "sha256:728df59b372c9588b83153facf26d3d28947fc750e8e3c95cefa9bed0e6394ee"}, + {file = "factory_boy-2.12.0.tar.gz", hash = "sha256:faf48d608a1735f0d0a3c9cbf536d64f9132b547dae7ba452c4d99a79e84a370"}, +] + +[package.dependencies] +Faker = ">=0.7.0" + [[package]] name = "faker" version = "0.9.1" @@ -1870,22 +1884,26 @@ wcwidth = "*" [[package]] name = "psycopg2" -version = "2.9.7" +version = "2.8.6" description = "psycopg2 - Python-PostgreSQL Database Adapter" optional = false -python-versions = ">=3.6" +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" files = [ - {file = "psycopg2-2.9.7-cp310-cp310-win32.whl", hash = "sha256:1a6a2d609bce44f78af4556bea0c62a5e7f05c23e5ea9c599e07678995609084"}, - {file = "psycopg2-2.9.7-cp310-cp310-win_amd64.whl", hash = "sha256:b22ed9c66da2589a664e0f1ca2465c29b75aaab36fa209d4fb916025fb9119e5"}, - {file = "psycopg2-2.9.7-cp311-cp311-win32.whl", hash = "sha256:44d93a0109dfdf22fe399b419bcd7fa589d86895d3931b01fb321d74dadc68f1"}, - {file = "psycopg2-2.9.7-cp311-cp311-win_amd64.whl", hash = "sha256:91e81a8333a0037babfc9fe6d11e997a9d4dac0f38c43074886b0d9dead94fe9"}, - {file = "psycopg2-2.9.7-cp37-cp37m-win32.whl", hash = "sha256:d1210fcf99aae6f728812d1d2240afc1dc44b9e6cba526a06fb8134f969957c2"}, - {file = "psycopg2-2.9.7-cp37-cp37m-win_amd64.whl", hash = "sha256:e9b04cbef584310a1ac0f0d55bb623ca3244c87c51187645432e342de9ae81a8"}, - {file = "psycopg2-2.9.7-cp38-cp38-win32.whl", hash = "sha256:d5c5297e2fbc8068d4255f1e606bfc9291f06f91ec31b2a0d4c536210ac5c0a2"}, - {file = "psycopg2-2.9.7-cp38-cp38-win_amd64.whl", hash = "sha256:8275abf628c6dc7ec834ea63f6f3846bf33518907a2b9b693d41fd063767a866"}, - {file = "psycopg2-2.9.7-cp39-cp39-win32.whl", hash = "sha256:c7949770cafbd2f12cecc97dea410c514368908a103acf519f2a346134caa4d5"}, - {file = "psycopg2-2.9.7-cp39-cp39-win_amd64.whl", hash = "sha256:b6bd7d9d3a7a63faae6edf365f0ed0e9b0a1aaf1da3ca146e6b043fb3eb5d723"}, - {file = "psycopg2-2.9.7.tar.gz", hash = "sha256:f00cc35bd7119f1fed17b85bd1007855194dde2cbd8de01ab8ebb17487440ad8"}, + {file = "psycopg2-2.8.6-cp27-cp27m-win32.whl", hash = "sha256:068115e13c70dc5982dfc00c5d70437fe37c014c808acce119b5448361c03725"}, + {file = "psycopg2-2.8.6-cp27-cp27m-win_amd64.whl", hash = "sha256:d160744652e81c80627a909a0e808f3c6653a40af435744de037e3172cf277f5"}, + {file = "psycopg2-2.8.6-cp34-cp34m-win32.whl", hash = "sha256:b8cae8b2f022efa1f011cc753adb9cbadfa5a184431d09b273fb49b4167561ad"}, + {file = "psycopg2-2.8.6-cp34-cp34m-win_amd64.whl", hash = "sha256:f22ea9b67aea4f4a1718300908a2fb62b3e4276cf00bd829a97ab5894af42ea3"}, + {file = "psycopg2-2.8.6-cp35-cp35m-win32.whl", hash = "sha256:26e7fd115a6db75267b325de0fba089b911a4a12ebd3d0b5e7acb7028bc46821"}, + {file = "psycopg2-2.8.6-cp35-cp35m-win_amd64.whl", hash = "sha256:00195b5f6832dbf2876b8bf77f12bdce648224c89c880719c745b90515233301"}, + {file = "psycopg2-2.8.6-cp36-cp36m-win32.whl", hash = "sha256:a49833abfdede8985ba3f3ec641f771cca215479f41523e99dace96d5b8cce2a"}, + {file = "psycopg2-2.8.6-cp36-cp36m-win_amd64.whl", hash = "sha256:f974c96fca34ae9e4f49839ba6b78addf0346777b46c4da27a7bf54f48d3057d"}, + {file = "psycopg2-2.8.6-cp37-cp37m-win32.whl", hash = "sha256:6a3d9efb6f36f1fe6aa8dbb5af55e067db802502c55a9defa47c5a1dad41df84"}, + {file = "psycopg2-2.8.6-cp37-cp37m-win_amd64.whl", hash = "sha256:56fee7f818d032f802b8eed81ef0c1232b8b42390df189cab9cfa87573fe52c5"}, + {file = "psycopg2-2.8.6-cp38-cp38-win32.whl", hash = "sha256:ad2fe8a37be669082e61fb001c185ffb58867fdbb3e7a6b0b0d2ffe232353a3e"}, + {file = "psycopg2-2.8.6-cp38-cp38-win_amd64.whl", hash = "sha256:56007a226b8e95aa980ada7abdea6b40b75ce62a433bd27cec7a8178d57f4051"}, + {file = "psycopg2-2.8.6-cp39-cp39-win32.whl", hash = "sha256:2c93d4d16933fea5bbacbe1aaf8fa8c1348740b2e50b3735d1b0bf8154cbf0f3"}, + {file = "psycopg2-2.8.6-cp39-cp39-win_amd64.whl", hash = "sha256:d5062ae50b222da28253059880a871dc87e099c25cb68acf613d9d227413d6f7"}, + {file = "psycopg2-2.8.6.tar.gz", hash = "sha256:fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543"}, ] [[package]] @@ -1977,17 +1995,17 @@ test = ["pytest (>3,<4)", "pytest-cov", "pytest-runner"] [[package]] name = "pylint" -version = "2.6.2" +version = "2.6.0" description = "python code static checker" optional = false python-versions = ">=3.5.*" files = [ - {file = "pylint-2.6.2-py3-none-any.whl", hash = "sha256:e71c2e9614a4f06e36498f310027942b0f4f2fde20aebb01655b31edc63b9eaf"}, - {file = "pylint-2.6.2.tar.gz", hash = "sha256:718b74786ea7ed07aa0c58bf572154d4679f960d26e9641cc1de204a30b87fc9"}, + {file = "pylint-2.6.0-py3-none-any.whl", hash = "sha256:bfe68f020f8a0fece830a22dd4d5dddb4ecc6137db04face4c3420a46a52239f"}, + {file = "pylint-2.6.0.tar.gz", hash = "sha256:bb4a908c9dadbc3aac18860550e870f58e1a02c9f2c204fdf5693d73be061210"}, ] [package.dependencies] -astroid = ">=2.4.0,<2.5" +astroid = ">=2.4.0,<=2.5" colorama = {version = "*", markers = "sys_platform == \"win32\""} isort = ">=4.2.5,<6" mccabe = ">=0.6,<0.7" @@ -1995,13 +2013,13 @@ toml = ">=0.7.1" [[package]] name = "pylint-django" -version = "2.4.4" +version = "2.1.0" description = "A Pylint plugin to help Pylint understand the Django web framework" optional = false python-versions = "*" files = [ - {file = "pylint-django-2.4.4.tar.gz", hash = "sha256:f63f717169b0c2e4e19c28f1c32c28290647330184fcb7427805ae9b6994f3fc"}, - {file = "pylint_django-2.4.4-py3-none-any.whl", hash = "sha256:aff49d9602a39c027b4ed7521a041438893205918f405800063b7ff692b7371b"}, + {file = "pylint-django-2.1.0.tar.gz", hash = "sha256:b7756844dba0cecd3471056a1ef4154439defedaba38bf3ced9f848d2bf6297c"}, + {file = "pylint_django-2.1.0-py3-none-any.whl", hash = "sha256:ca32277c77878dd3c2d9e75f3f3f7f0c0712f053f10ff1b946cdc27367a6c911"}, ] [package.dependencies] @@ -3048,5 +3066,5 @@ files = [ [metadata] lock-version = "2.0" -python-versions = "3.9.5" -content-hash = "23d9ca8098fd1f0b229ddb03fd3efc5f3c38e02399dbf5bd8ca02271b28b00e7" +python-versions = "3.9.17" +content-hash = "e49e485987778a3f5b4a7edafcbd2dd90f1981f387604b193b708162b7429bd5" diff --git a/pylintrc b/pylintrc index 264693a717..e8e8b916d8 100644 --- a/pylintrc +++ b/pylintrc @@ -1,6 +1,7 @@ [MASTER] ignore=migrations,.git load-plugins = pylint_django +django-settings-module = micromasters.settings [BASIC] # Allow django's urlpatterns, and our log preference diff --git a/pyproject.toml b/pyproject.toml index c178d93ec7..7e9fe0a017 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ django-hijack = "2.1.10" django-hijack-admin = "2.1.10" django-ipware = "3.0.0" django-redis = "5.2.0" -django-robots = "4.0.0" +django-robots = "~4.0.0" django-role-permissions = "2.2.0" django-server-status = "0.7.3" django-storages = "1.9.1" @@ -32,8 +32,6 @@ edx-api-client = "1.2.0" edx-opaque-keys = "0.4" opensearch-py = "1.0.0" opensearch-dsl = "1.0.0" - -faker = "0.9.1" html5lib = "0.999999999" l18n = "2021.3" ipython = "8.10.0" @@ -42,19 +40,19 @@ jsonpatch = "1.16" newrelic = "6.0.1.155" open-discussions-client = "0.5.0" phonenumbers = "8.10.23" -psycopg2 = "^2.9.5" +psycopg2 = "2.8.6" pycountry = "16.11.27.1" python-dateutil = "2.5.3" sentry-sdk = "1.1.0" redis = "3.5.3" -requests = "2.25.1" +requests = "^2.25.1" setuptools = "67.6.1" -six = "1.14.0" +six = "^1.14.0" social-auth-app-django = "3.1.0" robohash = "1.0" static3 = "0.5.1" -urllib3 = "1.26.5" -uwsgi = "2.0.18" +urllib3 = "^1.26.5" +uwsgi = "^2.0.18" wagtail = "2.12.5" flaky = "3.7.0" pyOpenSSL = "^23.1.1" @@ -66,19 +64,43 @@ astroid= "2.4.2" bpython = "^0.24" ddt = "^1.6.0" django-debug-toolbar = "^3.2.4" +factory-boy = "^2.8.1" +faker = "0.9.1" ipdb = "^0.13.13" nplusone = "^0.8.1" pdbpp = "^0.10.3" pip-tools = "^7.1.0" -pylint = "^2.6.0" -pylint-django = "^2.4.4" -pylint-plugin-utils= "^0.6" +pylint = "2.6.0" +pylint-django = "2.1.0" +pylint-plugin-utils = "0.6" pytest = "5.3.5" pytest-cov = "^4.1.0" pytest-django = "^3.8.0" pytest-mock = "^3.11.1" semantic-version = "^2.10.0" -selenium= "3.141.0" +selenium = "3.141.0" testfixtures = "7.1.0" tox = "3.28.0" -isort= "4.3.21" \ No newline at end of file +isort = "4.3.21" + +[tool.pytest.ini_options] +addopts = ''' +--cov . +--cov-report term +--cov-report html +--cov-report xml +--ds=micromasters.settings +--reuse-db''' +norecursedirs = [ + "node_modules", + ".git", + ".tox", + "static", + "templates", + ".*", + "CVS", + "_darcs", + "{arch}", + "*.egg", + "selenium_tests", +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 465067797d..0000000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -addopts = --cov . --cov-report term --cov-report html --cov-report xml --ds=micromasters.settings --reuse-db -norecursedirs = node_modules .git .tox static templates .* CVS _darcs {arch} *.egg selenium_tests diff --git a/pytest_minimal.ini b/pytest_minimal.ini deleted file mode 100644 index a83f920972..0000000000 --- a/pytest_minimal.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -addopts = --ds=micromasters.settings -norecursedirs = node_modules .git .tox static templates .* CVS _darcs {arch} *.egg selenium_tests diff --git a/runtime.txt b/runtime.txt deleted file mode 100644 index 1a18179443..0000000000 --- a/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.9.1 diff --git a/tox.ini b/tox.ini index 179ab897ec..29a85a7607 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,12 @@ [tox] envlist = py39 skipsdist = True +isolated_build = true [testenv] -sitepackages = True -deps = - -r{toxinidir}/requirements.txt - -r{toxinidir}/test_requirements.txt +allowlist_externals = poetry +commands_pre = + poetry install commands = py.test {posargs} {toxinidir}/scripts/test/detect_missing_migrations.sh