From 0190f4de08dd4c31c800a53d49253cd71ade2807 Mon Sep 17 00:00:00 2001 From: Danyal-Faheem Date: Tue, 28 May 2024 14:59:09 +0500 Subject: [PATCH 1/4] build: add python 3.11 and python 3.12 ci checks --- .github/workflows/ci.yml | 48 +- Makefile | 51 +- .../basket/migrations/0018_line_tax_code.py | 18 + .../migrations/0058_auto_20240528_0754.py | 39 + .../migrations/0056_auto_20240528_0754.py | 51 ++ .../migrations/0029_auto_20240528_0754.py | 64 ++ pylintrc | 681 +++++++++++------- pylintrc_backup | 294 ++++++++ requirements/base.in | 4 +- requirements/base.txt | 128 +++- requirements/constraints.txt | 24 +- requirements/dev.in | 4 +- requirements/dev.txt | 170 +++-- requirements/docs.txt | 18 +- requirements/e2e.txt | 46 +- requirements/pip.txt | 2 +- requirements/pip_tools.txt | 2 +- requirements/production.in | 2 + requirements/production.txt | 132 +++- requirements/test.in | 2 + requirements/test.txt | 185 +++-- requirements/tox.txt | 10 +- tox.ini | 4 +- 23 files changed, 1444 insertions(+), 535 deletions(-) create mode 100644 ecommerce/extensions/basket/migrations/0018_line_tax_code.py create mode 100644 ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py create mode 100644 ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py create mode 100644 ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py create mode 100644 pylintrc_backup diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d11de37d26..6dac14d2d80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,47 +11,56 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - include: - - django-env: django32 - testname: quality-and-jobs - targets: PYTHON_ENV=py38 requirements.js check_translations_up_to_date validate_translations clean_static static quality validate_js check_keywords - - django-env: django32 - testname: test-python - targets: PYTHON_ENV=py38 requirements.js clean_static static validate_python - - django-env: django32 - testname: acceptance-python - targets: PYTHON_ENV=py38 requirements.js clean_static static acceptance - + python-version: ['py38', 'py311', 'py312'] + django-env: ['django32'] + test: ['acceptance-python', 'test-python', 'quality-and-jobs'] steps: - uses: actions/checkout@v2 + - name: Setup and Format Python Version + id: format_python_version + shell: bash + run: | + # Remove 'py' and insert a dot to format the version + FORMATTED_VERSION=${{ matrix.python-version }} # e.g., py38 + FORMATTED_VERSION=${FORMATTED_VERSION/py3/3.} # becomes 3.8 + # Set environment variables + echo "PYTHON_VERSION=$FORMATTED_VERSION" >> $GITHUB_ENV - name: Start container run: | - docker-compose -f ./.ci/docker-compose-ci.yml up -d + docker compose -f ./.ci/docker-compose-ci.yml up -d + docker exec ecommerce_testing bash -c " + sudo apt-get update -y && + sudo apt-get install python$PYTHON_VERSION \ + python$PYTHON_VERSION-dev \ + python$PYTHON_VERSION-distutils \ + default-libmysqlclient-dev build-essential pkg-config -y && + curl -sS https://bootstrap.pypa.io/get-pip.py | python$PYTHON_VERSION;" + # Need to install pip from source here^ otherwise some packages don't get installed - name: Install dependencies run: | docker exec -t ecommerce_testing bash -c " cd /edx/app/ecommerce/ecommerce/ && - python3 -m pip install tox + python$PYTHON_VERSION -m pip install tox " - name: Run tests run: | docker exec -t -e CI=1 ecommerce_testing bash -c " cd /edx/app/ecommerce/ecommerce/ && PATH=\$PATH:/edx/app/ecommerce/nodeenvs/ecommerce/bin:/snap/bin - DJANGO_ENV=${{ matrix.django-env }} make ${{ matrix.targets }} + DJANGO_ENV=${{ matrix.django-env }} PYTHON_ENV=${{ matrix.python-version }} PYTHON_VERSION=$PYTHON_VERSION make ${{ matrix.test }} " - name: Run coverage - if: matrix.testname == 'test-python' + if: matrix.test == 'test-python' run: | docker exec ecommerce_testing /edx/app/ecommerce/ecommerce/.ci/run_coverage.sh - name: Setup Python - if: matrix.testname == 'test-python' + if: matrix.test == 'test-python' && matrix.python-version == 'py38' uses: actions/setup-python@v2 with: python-version: "3.8" architecture: x64 - name: Report coverage - if: matrix.testname == 'test-python' + if: matrix.test == 'test-python' && matrix.python-version == 'py38' uses: codecov/codecov-action@v3 with: flags: unittests @@ -59,11 +68,14 @@ jobs: docs: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.11', '3.12'] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.8" + python-version: ${{matrix.python-version}} architecture: x64 - name: Install Dependencies run: pip install -r requirements/docs.txt -r requirements/tox.txt diff --git a/Makefile b/Makefile index bdf5d197510..1af72941998 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ NODE_BIN=./node_modules/.bin DIFF_COVER_BASE_BRANCH=master -PYTHON_ENV=py38 +PYTHON_ENV_VAR=$(if $(PYTHON_ENV),$(PYTHON_ENV),py312) DJANGO_ENV_VAR=$(if $(DJANGO_ENV),$(DJANGO_ENV),django32) +PYTHON_VERSION_VAR=$(if $(PYTHON_VERSION),$(PYTHON_VERSION),3.12) help: @echo '' @@ -45,17 +46,17 @@ requirements: requirements.js pip3 install -r requirements/dev.txt --exists-action w requirements.tox: - pip3 install -U pip==20.0.2 + pip3 install -U pip pip3 install -r requirements/tox.txt --exists-action w production-requirements: requirements.js pip3 install -r requirements.txt --exists-action w migrate: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-migrate + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-migrate serve: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-serve + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-serve clean: find . -name '*.pyc' -delete @@ -65,18 +66,18 @@ clean_static: rm -rf assets/* ecommerce/static/build/* run_check_isort: requirements.tox - tox -e $(PYTHON_ENV)-check_isort + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-check_isort run_isort: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-run_isort + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-run_isort run_pycodestyle: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-pycodestyle + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-pycodestyle run_pep8: run_pycodestyle run_pylint: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-pylint + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-pylint quality: run_check_isort run_pycodestyle run_pylint @@ -86,42 +87,42 @@ validate_js: $(NODE_BIN)/gulp lint validate_python: clean requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-tests + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-tests acceptance: clean requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-acceptance + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-acceptance fast_validate_python: clean requirements.tox - DISABLE_ACCEPTANCE_TESTS=True tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-tests + DISABLE_ACCEPTANCE_TESTS=True python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-tests validate: validate_python validate_js quality theme_static: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-theme_static + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-theme_static static: requirements.js theme_static requirements.tox $(NODE_BIN)/r.js -o build.js - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-static + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-static html_coverage: requirements.tox - tox -e $(PYTHON_ENV)-coverage_html + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-coverage_html diff_coverage: validate fast_diff_coverage fast_diff_coverage: requirements.tox - tox -e $(PYTHON_ENV)-fast_diff_coverage + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-fast_diff_coverage e2e: requirements.tox - tox -e $(PYTHON_ENV)-e2e + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-e2e extract_translations: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-extract_translations + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-extract_translations dummy_translations: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-dummy_translations + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-dummy_translations compile_translations: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-compile_translations + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-compile_translations fake_translations: extract_translations dummy_translations compile_translations @@ -134,18 +135,18 @@ update_translations: pull_translations fake_translations # extract_translations should be called before this command can detect changes detect_changed_source_translations: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-detect_changed_translations + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-detect_changed_translations # @FIXME: skip detect_changed_source_translations until git diff works again (REV-2737) check_translations_up_to_date: fake_translations # detect_changed_source_translations # Validate translations validate_translations: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-validate_translations + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-validate_translations # Scan the Django models in all installed apps in this project for restricted field names check_keywords: requirements.tox - tox -e $(PYTHON_ENV)-${DJANGO_ENV_VAR}-check_keywords + python$(PYTHON_VERSION_VAR) -m tox -e $(PYTHON_ENV_VAR)-${DJANGO_ENV_VAR}-check_keywords COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt .PHONY: $(COMMON_CONSTRAINTS_TXT) @@ -173,6 +174,12 @@ upgrade: $(COMMON_CONSTRAINTS_TXT) docs: tox -e docs +quality-and-jobs: requirements.js check_translations_up_to_date validate_translations clean_static static quality validate_js check_keywords + +test-python: requirements.js clean_static static validate_python + +acceptance-python: requirements.js clean_static static acceptance + # Targets in a Makefile which do not produce an output file with the same name as the target name .PHONY: help requirements migrate serve clean validate_python quality validate_js validate html_coverage e2e \ extract_translations dummy_translations compile_translations fake_translations pull_translations \ diff --git a/ecommerce/extensions/basket/migrations/0018_line_tax_code.py b/ecommerce/extensions/basket/migrations/0018_line_tax_code.py new file mode 100644 index 00000000000..914ac028892 --- /dev/null +++ b/ecommerce/extensions/basket/migrations/0018_line_tax_code.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.25 on 2024-05-28 07:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('basket', '0017_alter_lineattribute_value'), + ] + + operations = [ + migrations.AddField( + model_name='line', + name='tax_code', + field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), + ), + ] diff --git a/ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py b/ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py new file mode 100644 index 00000000000..b671354b457 --- /dev/null +++ b/ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py @@ -0,0 +1,39 @@ +# Generated by Django 3.2.25 on 2024-05-28 07:54 + +from django.db import migrations +import oscar.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0057_auto_20231205_1034'), + ] + + operations = [ + migrations.AddField( + model_name='attributeoption', + name='code', + field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Unique identifier'), + ), + migrations.AddField( + model_name='attributeoptiongroup', + name='code', + field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Unique identifier'), + ), + migrations.AddField( + model_name='category', + name='code', + field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Code'), + ), + migrations.AddField( + model_name='historicalcategory', + name='code', + field=oscar.models.fields.NullCharField(db_index=True, max_length=255, verbose_name='Code'), + ), + migrations.AddField( + model_name='productimage', + name='code', + field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Code'), + ), + ] diff --git a/ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py b/ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py new file mode 100644 index 00000000000..622374420bd --- /dev/null +++ b/ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py @@ -0,0 +1,51 @@ +# Generated by Django 3.2.25 on 2024-05-28 07:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('offer', '0055_auto_20231108_1355'), + ] + + operations = [ + migrations.CreateModel( + name='FixedUnitDiscountBenefit', + fields=[ + ], + options={ + 'verbose_name': 'Fixed unit discount benefit', + 'verbose_name_plural': 'Fixed unit discount benefits', + 'proxy': True, + 'indexes': [], + 'constraints': [], + }, + bases=('offer.absolutediscountbenefit',), + ), + migrations.AddField( + model_name='rangeproductfileupload', + name='upload_type', + field=models.CharField(choices=[('included', 'Included products upload'), ('excluded', 'Excluded products upload')], default='included', max_length=8), + ), + migrations.AlterField( + model_name='benefit', + name='type', + field=models.CharField(blank=True, choices=[('Percentage', "Discount is a percentage off of the product's value"), ('Absolute', "Discount is a fixed amount off of the basket's total"), ('Fixed', "Discount is a fixed amount off of the product's value"), ('Multibuy', 'Discount is to give the cheapest product for free'), ('Fixed price', 'Get the products that meet the condition for a fixed price'), ('Shipping absolute', 'Discount is a fixed amount of the shipping cost'), ('Shipping fixed price', 'Get shipping for a fixed price'), ('Shipping percentage', 'Discount is a percentage off of the shipping cost')], max_length=128, verbose_name='Type'), + ), + migrations.AlterField( + model_name='historicalbenefit', + name='type', + field=models.CharField(blank=True, choices=[('Percentage', "Discount is a percentage off of the product's value"), ('Absolute', "Discount is a fixed amount off of the basket's total"), ('Fixed', "Discount is a fixed amount off of the product's value"), ('Multibuy', 'Discount is to give the cheapest product for free'), ('Fixed price', 'Get the products that meet the condition for a fixed price'), ('Shipping absolute', 'Discount is a fixed amount of the shipping cost'), ('Shipping fixed price', 'Get shipping for a fixed price'), ('Shipping percentage', 'Discount is a percentage off of the shipping cost')], max_length=128, verbose_name='Type'), + ), + migrations.AlterField( + model_name='historicalrange', + name='description', + field=models.TextField(blank=True, verbose_name='Description'), + ), + migrations.AlterField( + model_name='range', + name='description', + field=models.TextField(blank=True, verbose_name='Description'), + ), + ] diff --git a/ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py b/ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py new file mode 100644 index 00000000000..1eec0476ee7 --- /dev/null +++ b/ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py @@ -0,0 +1,64 @@ +# Generated by Django 3.2.25 on 2024-05-28 07:54 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('order', '0028_alter_lineattribute_value'), + ] + + operations = [ + migrations.AlterModelOptions( + name='surcharge', + options={'ordering': ['pk'], 'verbose_name': 'Surcharge', 'verbose_name_plural': 'Surcharges'}, + ), + migrations.AddField( + model_name='historicalline', + name='tax_code', + field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), + ), + migrations.AddField( + model_name='historicalorder', + name='shipping_tax_code', + field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Shipping VAT rate code'), + ), + migrations.AddField( + model_name='line', + name='tax_code', + field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), + ), + migrations.AddField( + model_name='lineprice', + name='tax_code', + field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), + ), + migrations.AddField( + model_name='order', + name='shipping_tax_code', + field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Shipping VAT rate code'), + ), + migrations.AddField( + model_name='surcharge', + name='tax_code', + field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), + ), + migrations.CreateModel( + name='OrderLineDiscount', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('is_incl_tax', models.BooleanField()), + ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Line discount (excl. tax)')), + ('line', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='discounts', to='order.line', verbose_name='Line')), + ('order_discount', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='discount_lines', to='order.orderdiscount', verbose_name='Order discount')), + ], + options={ + 'verbose_name': 'Order line discount', + 'verbose_name_plural': 'Order line discounts', + 'ordering': ['pk'], + 'abstract': False, + }, + ), + ] diff --git a/pylintrc b/pylintrc index 7206c5f1f05..99f7ae52979 100644 --- a/pylintrc +++ b/pylintrc @@ -1,294 +1,431 @@ +# *************************** +# ** DO NOT EDIT THIS FILE ** +# *************************** +# +# This file was generated by edx-lint: https://github.com/openedx/edx-lint +# +# If you want to change this file, you have two choices, depending on whether +# you want to make a local change that applies only to this repo, or whether +# you want to make a central change that applies to all repos using edx-lint. +# +# Note: If your pylintrc file is simply out-of-date relative to the latest +# pylintrc in edx-lint, ensure you have the latest edx-lint installed +# and then follow the steps for a "LOCAL CHANGE". +# +# LOCAL CHANGE: +# +# 1. Edit the local pylintrc_tweaks file to add changes just to this +# repo's file. +# +# 2. Run: +# +# $ edx_lint write pylintrc +# +# 3. This will modify the local file. Submit a pull request to get it +# checked in so that others will benefit. +# +# +# CENTRAL CHANGE: +# +# 1. Edit the pylintrc file in the edx-lint repo at +# https://github.com/openedx/edx-lint/blob/master/edx_lint/files/pylintrc +# +# 2. install the updated version of edx-lint (in edx-lint): +# +# $ pip install . +# +# 3. Run (in edx-lint): +# +# $ edx_lint write pylintrc +# +# 4. Make a new version of edx_lint, submit and review a pull request with the +# pylintrc update, and after merging, update the edx-lint version and +# publish the new version. +# +# 5. In your local repo, install the newer version of edx-lint. +# +# 6. Run: +# +# $ edx_lint write pylintrc +# +# 7. This will modify the local file. Submit a pull request to get it +# checked in so that others will benefit. +# +# +# +# +# +# STAY AWAY FROM THIS FILE! +# +# +# +# +# +# SERIOUSLY. +# +# ------------------------------ +# Generated by edx-lint version: 5.3.6 +# ------------------------------ [MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook='' - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS, migrations, settings, wsgi.py - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= +ignore = +persistent = yes +load-plugins = edx_lint.pylint,pylint_django,pylint_celery [MESSAGES CONTROL] - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). -disable= -# Never going to use these -# I0011: Locally disabling W0232 -# W0141: Used builtin function 'map' -# W0142: Used * or ** magic -# R0921: Abstract class not referenced -# R0922: Abstract class is only referenced 1 times - I0011,W0141,W0142,R0921,R0922, - -# Django makes classes that trigger these -# W0232: Class has no __init__ method - W0232, - -# Might use these when the code is in better shape -# C0302: Too many lines in module -# R0201: Method could be a function -# R0901: Too many ancestors -# R0902: Too many instance attributes -# R0903: Too few public methods (1/2) -# R0904: Too many public methods -# R0911: Too many return statements -# R0912: Too many branches -# R0913: Too many arguments -# R0914: Too many local variables - C0302,R0201,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914, -# W0511: TODOs etc - W0511, -# E1103: maybe no member - E1103, -# C0111: missing docstring (handled by pep257) - C0111, - - duplicate-code, - -# New when we unpinned and jumped versions (pylint 2.4.4 -> 2.12.2) -# C0103: invalid-name -# C0201: consider-iterating-dictionary -# C0206: consider-using-dict-items -# C0209: consider-using-f-string -# R1725: super-with-arguments -# R1728: consider-using-generator -# R1729: use-a-generator -# R1734: use-list-literal -# W0237: arguments renamed -# W1310: format-string-without-interpolation -# W1406: redundant-u-string-prefix -# W1514: unspecified-encoding - - C0103,C0201,C0206,C0209,R1725,R1728,R1729,R1734,W0237,W1310,W1406,W1514 - -# We can decide if names are invalid on our own - invalid-name, - -# We use isort for import order, so we can ignore -# the pylint import errors, since they conflict at times. - wrong-import-order, - ungrouped-imports, +enable = + blacklisted-name, + line-too-long, + + abstract-class-instantiated, + abstract-method, + access-member-before-definition, + anomalous-backslash-in-string, + anomalous-unicode-escape-in-string, + arguments-differ, + assert-on-tuple, + assigning-non-slot, + assignment-from-no-return, + assignment-from-none, + attribute-defined-outside-init, + bad-except-order, + bad-format-character, + bad-format-string-key, + bad-format-string, + bad-open-mode, + bad-reversed-sequence, + bad-staticmethod-argument, + bad-str-strip-call, + bad-super-call, + binary-op-exception, + boolean-datetime, + catching-non-exception, + cell-var-from-loop, + confusing-with-statement, + continue-in-finally, + dangerous-default-value, + duplicate-argument-name, + duplicate-bases, + duplicate-except, + duplicate-key, + expression-not-assigned, + format-combined-specification, + format-needs-mapping, + function-redefined, + global-variable-undefined, + import-error, + import-self, + inconsistent-mro, + inherit-non-class, + init-is-generator, + invalid-all-object, + invalid-format-index, + invalid-length-returned, + invalid-sequence-index, + invalid-slice-index, + invalid-slots-object, + invalid-slots, + invalid-unary-operand-type, + logging-too-few-args, + logging-too-many-args, + logging-unsupported-format, + lost-exception, + method-hidden, + misplaced-bare-raise, + misplaced-future, + missing-format-argument-key, + missing-format-attribute, + missing-format-string-key, + no-member, + no-method-argument, + no-name-in-module, + no-self-argument, + no-value-for-parameter, + non-iterator-returned, + non-parent-method-called, + nonexistent-operator, + not-a-mapping, + not-an-iterable, + not-callable, + not-context-manager, + not-in-loop, + pointless-statement, + pointless-string-statement, + raising-bad-type, + raising-non-exception, + redefined-builtin, + redefined-outer-name, + redundant-keyword-arg, + repeated-keyword, + return-arg-in-generator, + return-in-init, + return-outside-function, + signature-differs, + super-init-not-called, + super-method-not-called, + syntax-error, + test-inherits-tests, + too-few-format-args, + too-many-format-args, + too-many-function-args, + translation-of-non-string, + truncated-format-string, + undefined-all-variable, + undefined-loop-variable, + undefined-variable, + unexpected-keyword-arg, + unexpected-special-method-signature, + unpacking-non-sequence, + unreachable, + unsubscriptable-object, + unsupported-binary-operation, + unsupported-membership-test, + unused-format-string-argument, + unused-format-string-key, + used-before-assignment, + using-constant-test, + yield-outside-function, + + astroid-error, + fatal, + method-check-failed, + parse-error, + raw-checker-failed, + + empty-docstring, + invalid-characters-in-docstring, + missing-docstring, + wrong-spelling-in-comment, + wrong-spelling-in-docstring, + + unused-argument, + unused-import, + unused-variable, + + eval-used, + exec-used, + + bad-classmethod-argument, + bad-mcs-classmethod-argument, + bad-mcs-method-argument, + bare-except, + broad-except, + consider-iterating-dictionary, + consider-using-enumerate, + global-at-module-level, + global-variable-not-assigned, + literal-used-as-attribute, + logging-format-interpolation, + logging-not-lazy, + multiple-imports, + multiple-statements, + no-classmethod-decorator, + no-staticmethod-decorator, + protected-access, + redundant-unittest-assert, + reimported, + simplifiable-if-statement, + simplifiable-range, + singleton-comparison, + superfluous-parens, + unidiomatic-typecheck, + unnecessary-lambda, + unnecessary-pass, + unnecessary-semicolon, + unneeded-not, + useless-else-on-loop, + wrong-assert-type, + + deprecated-method, + deprecated-module, + + too-many-boolean-expressions, + too-many-nested-blocks, + too-many-statements, + + wildcard-import, + wrong-import-order, + wrong-import-position, + + missing-final-newline, + mixed-line-endings, + trailing-newlines, + trailing-whitespace, + unexpected-line-ending-format, + + bad-inline-option, + bad-option-value, + deprecated-pragma, + unrecognized-inline-option, + useless-suppression, +disable = + bad-indentation, + broad-exception-raised, + consider-using-f-string, + duplicate-code, + file-ignored, + fixme, + global-statement, + invalid-name, + locally-disabled, + no-else-return, + suppressed-message, + too-few-public-methods, + too-many-ancestors, + too-many-arguments, + too-many-branches, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-public-methods, + too-many-return-statements, + ungrouped-imports, + unspecified-encoding, + unused-wildcard-import, + use-maxsplit-arg, + + feature-toggle-needs-doc, + illegal-waffle-usage, + + logging-fstring-interpolation, + super-method-not-called, # E7601: Super method not called + useless-suppression, # I0021: Useless suppression of ... + line-too-long, # C0301: Line too long + wildcard-import, # W0401: Wildcard import + raise-missing-from, # W0707: Consider explicitly re-raising ... + use-dict-literal, # R1735: Consider using a dict literal ... + R1725, # Consider using Python 3 style super() without arguments + W1406, # Implicit string concatenation found in parentheses + C0114, # Missing module docstring + C0115, # Missing class docstring + C0116, # Missing function or method docstring + C0411, # Standard import should be placed before any third party or local imports + E1101, # Instance of 'Class' has no 'member' member + C7620, # range() call could be single-argument + C7690, # Wrong assert type + C0206, # Consider iterating with .items() + E7665, # Invalid Django Waffle import + E7610, # i18n function _() must be called with a literal string + E1131, # Unsupported operand type(s) for | + W3101, # Missing timeout argument for method 'requests.get' + R1728, # Consider using a generator + W1404, # Implicit string concatenation + C0325, # Unnecessary parens after '=' keyword + R1734, # Consider using [] instead of list() (use-list-literal) + R1729, # Use a generator instead 'all(...)' (use-a-generator) + W0134, # 'return' shadowed by the 'finally' clause. (return-in-finally) + R1710, # Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) + C7630, # getattr using a literal attribute name (literal-used-as-attribute) + E7655, # Missing non-optional annotation: '.. toggle_implementation:' (annotation-missing-token) + W0237, # Parameter has been renamed in overriding method (arguments-renamed) + E0606, # Possibly using variable before assignment (possibly-used-before-assignment) + R1711, # Useless return at end of function or method (useless-return) + C0201, # Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary) + E7603, # Test class inherits tests from another test class (test-inherits-tests) + R1736, # Unnecessary list index lookup, use '_' instead (unnecessary-list-index-lookup) + W1310, # Using formatting for a string that does not have any interpolated variables (format-string-without-interpolation) + C2801, # Unnecessarily calls dunder method __str__. Use str built-in function. (unnecessary-dunder-call) + R0201, # Method could be a function + W0613, # Unused argument %r + W0611, # Unused import %s + E0013, # bad-plugin-value + E0213, # Method should have "self" as first argument + C0113, # Unneeded negation + W0612, # Unused variable %r + W0107 # Unnecessary pass statement [REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html -output-format=text - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=no - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members= - REQUEST, - acl_users, - aq_parent, - objects, - DoesNotExist, - can_read, - can_write, - get_url, - size, - content, - status_code, -# For factory_boy factories - create - +output-format = text +reports = no +score = no [BASIC] - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns)$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct method names -method-rgx=([a-z_][a-z0-9_]{2,60}|setUp|set[Uu]pClass|tearDown|tear[Dd]ownClass|assert[A-Z]\w*)$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__|test_.*|setUp|tearDown - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - +module-rgx = (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ +const-rgx = (([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns)$ +class-rgx = [A-Z_][a-zA-Z0-9]+$ +function-rgx = ([a-z_][a-z0-9_]{2,40}|test_[a-z0-9_]+)$ +method-rgx = ([a-z_][a-z0-9_]{2,40}|setUp|set[Uu]pClass|tearDown|tear[Dd]ownClass|assert[A-Z]\w*|maxDiff|test_[a-z0-9_]+)$ +attr-rgx = [a-z_][a-z0-9_]{2,30}$ +argument-rgx = [a-z_][a-z0-9_]{2,30}$ +variable-rgx = [a-z_][a-z0-9_]{2,30}$ +class-attribute-rgx = ([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ +inlinevar-rgx = [A-Za-z_][A-Za-z0-9_]*$ +good-names = f,i,j,k,db,ex,Run,_,__ +bad-names = foo,bar,baz,toto,tutu,tata +no-docstring-rgx = __.*__$|test_.+|setUp$|setUpClass$|tearDown$|tearDownClass$|Meta$ +docstring-min-length = 5 [FORMAT] +max-line-length = 120 +ignore-long-lines = ^\s*(# )?((?)|(\.\. \w+: .*))$ +single-line-if-stmt = no +max-module-lines = 1000 +indent-string = ' ' -# Maximum number of characters on a single line. -max-line-length=120 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - +[MISCELLANEOUS] +notes = FIXME,XXX,TODO [SIMILARITIES] +min-similarity-lines = 4 +ignore-comments = yes +ignore-docstrings = yes +ignore-imports = yes -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - +[TYPECHECK] +ignore-mixin-members = yes +ignored-classes = SQLObject +unsafe-load-any-extension = yes +generated-members = + REQUEST, + acl_users, + aq_parent, + objects, + DoesNotExist, + can_read, + can_write, + get_url, + size, + content, + status_code, + create, + build, + fields, + tag, + org, + course, + category, + name, + revision, + _meta, [VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the beginning of the name of dummy variables -# (i.e. not used). -dummy-variables-rgx=_|dummy|unused|.*_unused - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branchs=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - +init-import = no +dummy-variables-rgx = _|dummy|unused|.*_unused +additional-builtins = [CLASSES] +defining-attr-methods = __init__,__new__,setUp +valid-classmethod-first-arg = cls +valid-metaclass-classmethod-first-arg = mcs -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls +[DESIGN] +max-args = 5 +ignored-argument-names = _.* +max-locals = 15 +max-returns = 6 +max-branches = 12 +max-statements = 50 +max-parents = 7 +max-attributes = 7 +min-public-methods = 2 +max-public-methods = 20 +[IMPORTS] +deprecated-modules = regsub,TERMIOS,Bastion,rexec +import-graph = +ext-import-graph = +int-import-graph = [EXCEPTIONS] +overgeneral-exceptions = builtins.Exception -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception +# 5f343c05ade94b1f05eeb1763ca543bf867246f6 diff --git a/pylintrc_backup b/pylintrc_backup new file mode 100644 index 00000000000..7206c5f1f05 --- /dev/null +++ b/pylintrc_backup @@ -0,0 +1,294 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook='' + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS, migrations, settings, wsgi.py + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +[MESSAGES CONTROL] + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). +disable= +# Never going to use these +# I0011: Locally disabling W0232 +# W0141: Used builtin function 'map' +# W0142: Used * or ** magic +# R0921: Abstract class not referenced +# R0922: Abstract class is only referenced 1 times + I0011,W0141,W0142,R0921,R0922, + +# Django makes classes that trigger these +# W0232: Class has no __init__ method + W0232, + +# Might use these when the code is in better shape +# C0302: Too many lines in module +# R0201: Method could be a function +# R0901: Too many ancestors +# R0902: Too many instance attributes +# R0903: Too few public methods (1/2) +# R0904: Too many public methods +# R0911: Too many return statements +# R0912: Too many branches +# R0913: Too many arguments +# R0914: Too many local variables + C0302,R0201,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914, +# W0511: TODOs etc + W0511, +# E1103: maybe no member + E1103, +# C0111: missing docstring (handled by pep257) + C0111, + + duplicate-code, + +# New when we unpinned and jumped versions (pylint 2.4.4 -> 2.12.2) +# C0103: invalid-name +# C0201: consider-iterating-dictionary +# C0206: consider-using-dict-items +# C0209: consider-using-f-string +# R1725: super-with-arguments +# R1728: consider-using-generator +# R1729: use-a-generator +# R1734: use-list-literal +# W0237: arguments renamed +# W1310: format-string-without-interpolation +# W1406: redundant-u-string-prefix +# W1514: unspecified-encoding + + C0103,C0201,C0206,C0209,R1725,R1728,R1729,R1734,W0237,W1310,W1406,W1514 + +# We can decide if names are invalid on our own + invalid-name, + +# We use isort for import order, so we can ignore +# the pylint import errors, since they conflict at times. + wrong-import-order, + ungrouped-imports, + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html +output-format=text + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". +files-output=no + +# Tells whether to display a full report or only the messages +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +[TYPECHECK] + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +ignored-classes=SQLObject + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. Python regular +# expressions are accepted. +generated-members= + REQUEST, + acl_users, + aq_parent, + objects, + DoesNotExist, + can_read, + can_write, + get_url, + size, + content, + status_code, +# For factory_boy factories + create + + +[BASIC] + +# List of builtins function names that should not be used, separated by a comma +bad-functions=map,filter,apply,input + +# Regular expression which should only match correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression which should only match correct module level names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns)$ + +# Regular expression which should only match correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression which should only match correct function names +function-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct method names +method-rgx=([a-z_][a-z0-9_]{2,60}|setUp|set[Uu]pClass|tearDown|tear[Dd]ownClass|assert[A-Z]\w*)$ + +# Regular expression which should only match correct instance attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct list comprehension / +# generator expression variable names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Regular expression which should only match functions or classes name which do +# not require a docstring +no-docstring-rgx=__.*__|test_.*|setUp|tearDown + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=120 + +# Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the beginning of the name of dummy variables +# (i.e. not used). +dummy-variables-rgx=_|dummy|unused|.*_unused + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,TERMIOS,Bastion,rexec + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branchs=12 + +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception diff --git a/requirements/base.in b/requirements/base.in index ba09e456848..16c4826fcf9 100755 --- a/requirements/base.in +++ b/requirements/base.in @@ -31,6 +31,7 @@ edx-django-utils edx-drf-extensions>=8.13.0 # 8.13 fixes forgiven JWTs for ecommerce edx-django-sites-extensions edx-ecommerce-worker +edx-lint edx-opaque-keys edx-rbac edx-rest-api-client @@ -43,9 +44,10 @@ jsonfield2 libsass lxml[html_clean] markdown==3.4.3 -mysqlclient<1.5 +mysqlclient newrelic ndg-httpsclient +needle openedx-atlas path.py==7.2 paypalrestsdk diff --git a/requirements/base.txt b/requirements/base.txt index 86236bfe7aa..8290ef0700f 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -20,6 +20,11 @@ asgiref==3.8.1 # django-cors-headers asn1crypto==1.5.1 # via cybersource-rest-client-python +astroid==3.2.2 + # via + # -c requirements/constraints.txt + # pylint + # pylint-celery async-timeout==4.0.3 # via # aiohttp @@ -30,7 +35,7 @@ attrs==23.2.0 # jsonschema # referencing # zeep -babel==2.14.0 +babel==2.15.0 # via django-oscar backoff==1.10.0 # via analytics-python @@ -40,7 +45,7 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9" # celery # djangorestframework # kombu -bcrypt==4.1.2 +bcrypt==4.1.3 # via # cybersource-rest-client-python # paramiko @@ -48,9 +53,9 @@ billiard==4.2.0 # via celery bleach==6.1.0 # via -r requirements/base.in -boto3==1.34.96 +boto3==1.34.111 # via -r requirements/base.in -botocore==1.34.96 +botocore==1.34.111 # via # boto3 # s3transfer @@ -78,28 +83,35 @@ click==8.1.7 # via # celery # click-didyoumean + # click-log # click-plugins # click-repl + # code-annotations # edx-django-utils + # edx-lint click-didyoumean==0.3.1 # via celery +click-log==0.4.0 + # via edx-lint click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery +code-annotations==1.8.0 + # via edx-lint configparser==7.0.0 # via cybersource-rest-client-python coreapi==2.3.3 # via -r requirements/base.in coreschema==0.0.4 # via coreapi -coverage==7.5.0 +coverage==7.5.1 # via cybersource-rest-client-python crispy-bootstrap3==2024.1 # via -r requirements/base.in crypto==1.4.1 # via cybersource-rest-client-python -cryptography==42.0.5 +cryptography==42.0.7 # via # app-store-notifications-v2-validator # cybersource-rest-client-python @@ -109,7 +121,7 @@ cryptography==42.0.5 # social-auth-core cssselect==1.2.0 # via premailer -cssutils==2.10.2 +cssutils==2.11.0 # via premailer cybersource-rest-client-python==0.0.21 # via @@ -121,6 +133,8 @@ defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core +dill==0.3.8 + # via pylint django==3.2.25 # via # -c requirements/common_constraints.txt @@ -183,9 +197,9 @@ django-haystack==3.3b2 # via django-oscar django-libsass==0.9 # via -r requirements/base.in -django-model-utils==4.5.0 +django-model-utils==4.5.1 # via edx-rbac -django-oscar==3.2 +django-oscar==3.2.4 # via # -c requirements/constraints.txt # -r requirements/base.in @@ -240,7 +254,7 @@ edx-django-release-util==1.4.0 # via -r requirements/base.in edx-django-sites-extensions==4.2.0 # via -r requirements/base.in -edx-django-utils==5.13.0 +edx-django-utils==5.14.1 # via # -r requirements/base.in # django-config-models @@ -253,13 +267,17 @@ edx-drf-extensions==10.3.0 # edx-rbac edx-ecommerce-worker==3.3.4 # via -r requirements/base.in +edx-lint==5.3.6 + # via + # -c requirements/constraints.txt + # -r requirements/base.in edx-opaque-keys==2.9.0 # via # -r requirements/base.in # edx-drf-extensions edx-rbac==1.9.0 # via -r requirements/base.in -edx-rest-api-client==5.7.0 +edx-rest-api-client==5.6.1 # via # -r requirements/base.in # edx-ecommerce-worker @@ -269,7 +287,7 @@ extras==1.0.0 # via cybersource-rest-client-python factory-boy==3.2.1 # via django-oscar -faker==25.0.0 +faker==25.2.0 # via factory-boy fixtures==4.1.0 # via cybersource-rest-client-python @@ -324,10 +342,14 @@ iso8601==2.1.0 # via python-subunit isodate==0.6.1 # via zeep +isort==5.13.2 + # via pylint itypes==1.2.0 # via coreapi -jinja2==3.1.3 - # via coreschema +jinja2==3.1.4 + # via + # code-annotations + # coreschema jmespath==1.0.1 # via # boto3 @@ -352,7 +374,7 @@ linecache2==1.0.0 # traceback2 logger==1.4 # via cybersource-rest-client-python -lxml[html-clean,html_clean]==5.2.1 +lxml[html-clean,html_clean]==5.2.2 # via # -r requirements/base.in # lxml-html-clean @@ -364,13 +386,15 @@ markdown==3.4.3 # via -r requirements/base.in markupsafe==2.1.5 # via jinja2 +mccabe==0.7.0 + # via pylint monotonic==1.6 # via analytics-python multidict==6.0.5 # via # aiohttp # yarl -mysqlclient==1.4.6 +mysqlclient==2.2.4 # via -r requirements/base.in naked==0.1.32 # via @@ -378,12 +402,18 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/base.in -newrelic==9.9.0 +needle==0.5.0 + # via + # -c requirements/constraints.txt + # -r requirements/base.in +newrelic==9.9.1 # via # -r requirements/base.in # edx-django-utils nose==1.3.7 - # via cybersource-rest-client-python + # via + # cybersource-rest-client-python + # needle oauth2client==4.1.3 # via inapppy oauthlib==3.2.2 @@ -408,14 +438,18 @@ pbr==6.0.0 # cybersource-rest-client-python # fixtures # stevedore -phonenumbers==8.13.35 +phonenumbers==8.13.37 # via django-oscar pillow==10.3.0 - # via django-oscar + # via + # django-oscar + # needle pkgutil-resolve-name==1.3.10 # via jsonschema -platformdirs==4.2.1 - # via zeep +platformdirs==4.2.2 + # via + # pylint + # zeep premailer==2.9.2 # via -r requirements/base.in prompt-toolkit==3.0.43 @@ -454,7 +488,7 @@ pycryptodome==3.20.0 # via cybersource-rest-client-python pycryptodomex==3.20.0 # via cybersource-rest-client-python -pygments==2.17.2 +pygments==2.18.0 # via -r requirements/base.in pyjwt[crypto]==2.8.0 # via @@ -465,6 +499,21 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-rest-api-client # social-auth-core +pylint==3.2.2 + # via + # -c requirements/constraints.txt + # edx-lint + # pylint-celery + # pylint-django + # pylint-plugin-utils +pylint-celery==0.3 + # via edx-lint +pylint-django==2.5.5 + # via edx-lint +pylint-plugin-utils==0.8.2 + # via + # pylint-celery + # pylint-django pymongo==4.4.0 # via edx-opaque-keys pynacl==1.5.0 @@ -491,6 +540,8 @@ python-dateutil==2.9.0.post0 # faker python-mimeparse==1.6.0 # via cybersource-rest-client-python +python-slugify==8.0.4 + # via code-annotations python-subunit==1.4.4 # via cybersource-rest-client-python python-toolbox==1.0.11 @@ -512,6 +563,7 @@ pytz==2024.1 # zeep pyyaml==6.0.1 # via + # code-annotations # cybersource-rest-client-python # drf-yasg # edx-django-release-util @@ -524,8 +576,9 @@ referencing==0.35.1 # via # jsonschema # jsonschema-specifications -requests==2.31.0 +requests==2.32.2 # via + # -c requirements/constraints.txt # -r requirements/base.in # analytics-python # coreapi @@ -543,7 +596,7 @@ requests==2.31.0 # social-auth-core # stripe # zeep -requests-file==2.0.0 +requests-file==2.1.0 # via zeep requests-oauthlib==2.0.0 # via @@ -553,7 +606,7 @@ requests-toolbelt==1.0.0 # via zeep rjsmin==1.2.1 # via django-compressor -rpds-py==0.18.0 +rpds-py==0.18.1 # via # jsonschema # referencing @@ -563,10 +616,14 @@ rsa==4.9 # google-auth # inapppy # oauth2client -rules==3.3 +rules==3.4 # via -r requirements/base.in s3transfer==0.10.1 # via boto3 +selenium==3.141.0 + # via + # -c requirements/constraints.txt + # needle semantic-version==2.10.0 # via edx-drf-extensions shellescape==3.8.1 @@ -583,6 +640,7 @@ six==1.16.0 # edx-auth-backends # edx-django-release-util # edx-ecommerce-worker + # edx-lint # edx-rbac # isodate # oauth2client @@ -606,14 +664,21 @@ sqlparse==0.5.0 # via django stevedore==5.2.0 # via + # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.4.0 +stripe==9.7.0 # via -r requirements/base.in testtools==2.7.1 # via # cybersource-rest-client-python # python-subunit +text-unidecode==1.3 + # via python-slugify +tomli==2.0.1 + # via pylint +tomlkit==0.12.5 + # via pylint traceback2==1.4.0 # via cybersource-rest-client-python typing==3.7.4.3 @@ -621,8 +686,10 @@ typing==3.7.4.3 typing-extensions==4.11.0 # via # asgiref + # astroid # edx-opaque-keys # kombu + # pylint # stripe tzdata==2024.1 # via @@ -641,6 +708,7 @@ urllib3==1.26.18 # botocore # cybersource-rest-client-python # requests + # selenium vine==5.1.0 # via # amqp @@ -660,11 +728,11 @@ yarl==1.9.4 # via aiohttp zeep==4.2.1 # via -r requirements/base.in -zipp==3.18.1 +zipp==3.18.2 # via # importlib-metadata # importlib-resources -zope-interface==6.3 +zope-interface==6.4.post1 # via # cybersource-rest-client-python # datetime diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 101ce47f946..1e560deead6 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -15,13 +15,13 @@ cybersource-rest-client-python==0.0.21 # Django 3.2 support is added in version 2.2 so pinning it to 2.2 -django-oscar==3.2 +django-oscar==3.2.4 # Pinned because transifex-client==0.13.6 pins it urllib3>=1.24.2,<2.0.0 # Was causing some tox issues locally. -virtualenv==16.7.9 +virtualenv==20.26.2 # greater versions failing with extract-translations step. tox==3.14.6 @@ -41,17 +41,19 @@ social-auth-app-django==5.2.0 # (see pytest-selenium/issues/294) # - pytest-variables v3 uses pytest.stash instead of _variables. This # conflicts with how pytest-selenium uses variables prior to v3. -selenium<4.0.0 -pytest-selenium<3.0.0 -pytest-variables<3.0.0 +selenium<=4 +pytest-selenium==3.0.0 +pytest-variables==1.9.0 +needle==0.5.0 +requests==2.32.2 -# pylint>2.12.2 requires a lot of quality fixes. Can be resolved later on. -pylint==2.12.2 -# pylint==2.12.2 requires mccabe<0.7.0 -mccabe<0.7 -# pylint==2.12.2 requires wrapt<1.14 -wrapt<1.14 +pylint==3.2.2 +edx-lint==5.3.6 +astroid==3.2.2 # backports-zoneinfo comes by-default in newer versions of python # it gives error while building wheel with python>=3.9 backports.zoneinfo ; python_version < "3.9" + +# python3.8 does not support newer version +accessible-pygments==0.0.4 \ No newline at end of file diff --git a/requirements/dev.in b/requirements/dev.in index e45bfdb001a..cc864c661af 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -2,7 +2,7 @@ -r docs.txt django-debug-toolbar - +needle # i18n # newer version of transifex-client doesn't work with python3.12.2 transifex-client==0.12.5 @@ -12,3 +12,5 @@ ptvsd # For devserver code reloading pywatchman +astroid==3.2.2 +edx-lint \ No newline at end of file diff --git a/requirements/dev.txt b/requirements/dev.txt index 43bebdc53bb..6c45e70ff5f 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -37,10 +37,12 @@ asn1crypto==1.5.1 # via # -r requirements/test.txt # cybersource-rest-client-python -astroid==2.9.3 +astroid==3.2.2 # via + # -r requirements/dev.in # -r requirements/test.txt # pylint + # pylint-celery async-timeout==4.0.3 # via # -r requirements/test.txt @@ -51,9 +53,10 @@ attrs==23.2.0 # -r requirements/test.txt # aiohttp # jsonschema + # pytest # referencing # zeep -babel==2.14.0 +babel==2.15.0 # via # -r requirements/docs.txt # -r requirements/test.txt @@ -70,7 +73,7 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9" # celery # djangorestframework # kombu -bcrypt==4.1.2 +bcrypt==4.1.3 # via # -r requirements/test.txt # cybersource-rest-client-python @@ -87,9 +90,9 @@ billiard==4.2.0 # celery bleach==6.1.0 # via -r requirements/test.txt -boto3==1.34.96 +boto3==1.34.111 # via -r requirements/test.txt -botocore==1.34.96 +botocore==1.34.111 # via # -r requirements/test.txt # boto3 @@ -130,13 +133,20 @@ click==8.1.7 # -r requirements/test.txt # celery # click-didyoumean + # click-log # click-plugins # click-repl + # code-annotations # edx-django-utils + # edx-lint click-didyoumean==0.3.1 # via # -r requirements/test.txt # celery +click-log==0.4.0 + # via + # -r requirements/test.txt + # edx-lint click-plugins==1.1.1 # via # -r requirements/test.txt @@ -145,6 +155,10 @@ click-repl==0.3.0 # via # -r requirements/test.txt # celery +code-annotations==1.8.0 + # via + # -r requirements/test.txt + # edx-lint configparser==7.0.0 # via # -r requirements/test.txt @@ -155,7 +169,7 @@ coreschema==0.0.4 # via # -r requirements/test.txt # coreapi -coverage[toml]==7.5.0 +coverage[toml]==7.5.1 # via # -r requirements/test.txt # cybersource-rest-client-python @@ -166,7 +180,7 @@ crypto==1.4.1 # via # -r requirements/test.txt # cybersource-rest-client-python -cryptography==42.0.5 +cryptography==42.0.7 # via # -r requirements/test.txt # app-store-notifications-v2-validator @@ -179,7 +193,7 @@ cssselect==1.2.0 # via # -r requirements/test.txt # premailer -cssutils==2.10.2 +cssutils==2.11.0 # via # -r requirements/test.txt # premailer @@ -196,8 +210,16 @@ defusedxml==0.8.0rc2 # -r requirements/test.txt # python3-openid # social-auth-core -diff-cover==7.7.0 +diff-cover==9.0.0 # via -r requirements/test.txt +dill==0.3.8 + # via + # -r requirements/test.txt + # pylint +distlib==0.3.8 + # via + # -r requirements/test.txt + # virtualenv django==3.2.25 # via # -r requirements/test.txt @@ -270,11 +292,11 @@ django-haystack==3.3b2 # django-oscar django-libsass==0.9 # via -r requirements/test.txt -django-model-utils==4.5.0 +django-model-utils==4.5.1 # via # -r requirements/test.txt # edx-rbac -django-oscar==3.2 +django-oscar==3.2.4 # via -r requirements/test.txt django-phonenumber-field==6.4.0 # via @@ -346,7 +368,7 @@ edx-django-release-util==1.4.0 # via -r requirements/test.txt edx-django-sites-extensions==4.2.0 # via -r requirements/test.txt -edx-django-utils==5.13.0 +edx-django-utils==5.14.1 # via # -r requirements/test.txt # django-config-models @@ -361,13 +383,17 @@ edx-ecommerce-worker==3.3.4 # via -r requirements/test.txt edx-i18n-tools==1.6.0 # via -r requirements/test.txt +edx-lint==5.3.6 + # via + # -r requirements/dev.in + # -r requirements/test.txt edx-opaque-keys==2.9.0 # via # -r requirements/test.txt # edx-drf-extensions edx-rbac==1.9.0 # via -r requirements/test.txt -edx-rest-api-client==5.7.0 +edx-rest-api-client==5.6.1 # via # -r requirements/test.txt # edx-ecommerce-worker @@ -375,10 +401,6 @@ enum34==1.1.10 # via # -r requirements/test.txt # cybersource-rest-client-python -exceptiongroup==1.2.1 - # via - # -r requirements/test.txt - # pytest extras==1.0.0 # via # -r requirements/test.txt @@ -387,7 +409,7 @@ factory-boy==3.2.1 # via # -r requirements/test.txt # django-oscar -faker==25.0.0 +faker==25.2.0 # via # -r requirements/test.txt # factory-boy @@ -395,11 +417,12 @@ filelock==3.14.0 # via # -r requirements/test.txt # tox + # virtualenv fixtures==4.1.0 # via # -r requirements/test.txt # cybersource-rest-client-python -freezegun==1.5.0 +freezegun==1.5.1 # via -r requirements/test.txt frozenlist==1.4.1 # via @@ -497,13 +520,13 @@ itypes==1.2.0 # via # -r requirements/test.txt # coreapi -jinja2==3.1.3 +jinja2==3.1.4 # via # -r requirements/docs.txt # -r requirements/test.txt + # code-annotations # coreschema # diff-cover - # pytest-html # sphinx jmespath==1.0.1 # via @@ -526,10 +549,6 @@ kombu==5.3.7 # via # -r requirements/test.txt # celery -lazy-object-proxy==1.10.0 - # via - # -r requirements/test.txt - # astroid libsass==0.23.0 # via # -r requirements/test.txt @@ -543,7 +562,7 @@ logger==1.4 # via # -r requirements/test.txt # cybersource-rest-client-python -lxml[html-clean]==5.2.1 +lxml[html-clean]==5.2.2 # via # -r requirements/test.txt # edx-i18n-tools @@ -559,7 +578,7 @@ markupsafe==2.1.5 # -r requirements/docs.txt # -r requirements/test.txt # jinja2 -mccabe==0.6.1 +mccabe==0.7.0 # via # -r requirements/test.txt # pylint @@ -574,7 +593,7 @@ multidict==6.0.5 # -r requirements/test.txt # aiohttp # yarl -mysqlclient==1.4.6 +mysqlclient==2.2.4 # via -r requirements/test.txt naked==0.1.32 # via @@ -583,7 +602,11 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/test.txt -newrelic==9.9.0 +needle==0.5.0 + # via + # -r requirements/dev.in + # -r requirements/test.txt +newrelic==9.9.1 # via # -r requirements/test.txt # edx-django-utils @@ -591,6 +614,7 @@ nose==1.3.7 # via # -r requirements/test.txt # cybersource-rest-client-python + # needle oauth2client==4.1.3 # via # -r requirements/test.txt @@ -631,7 +655,7 @@ pbr==6.0.0 # cybersource-rest-client-python # fixtures # stevedore -phonenumbers==8.13.35 +phonenumbers==8.13.37 # via # -r requirements/test.txt # django-oscar @@ -639,14 +663,16 @@ pillow==10.3.0 # via # -r requirements/test.txt # django-oscar + # needle pkgutil-resolve-name==1.3.10 # via # -r requirements/test.txt # jsonschema -platformdirs==4.2.1 +platformdirs==4.2.2 # via # -r requirements/test.txt # pylint + # virtualenv # zeep pluggy==0.13.1 # via @@ -687,6 +713,8 @@ purl==1.6 py==1.11.0 # via # -r requirements/test.txt + # pytest + # pytest-html # tox pyasn1==0.6.0 # via @@ -725,7 +753,7 @@ pydata-sphinx-theme==0.14.4 # via # -r requirements/docs.txt # sphinx-book-theme -pygments==2.17.2 +pygments==2.18.0 # via # -r requirements/docs.txt # -r requirements/test.txt @@ -745,8 +773,26 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-rest-api-client # social-auth-core -pylint==2.12.2 - # via -r requirements/test.txt +pylint==3.2.2 + # via + # -r requirements/test.txt + # edx-lint + # pylint-celery + # pylint-django + # pylint-plugin-utils +pylint-celery==0.3 + # via + # -r requirements/test.txt + # edx-lint +pylint-django==2.5.5 + # via + # -r requirements/test.txt + # edx-lint +pylint-plugin-utils==0.8.2 + # via + # -r requirements/test.txt + # pylint-celery + # pylint-django pymongo==4.4.0 # via # -r requirements/test.txt @@ -772,7 +818,7 @@ pypi==2.1 # via # -r requirements/test.txt # cybersource-rest-client-python -pytest==7.4.4 +pytest==6.2.5 # via # -r requirements/test.txt # pytest-base-url @@ -784,29 +830,29 @@ pytest==7.4.4 # pytest-selenium # pytest-timeout # pytest-variables -pytest-base-url==2.1.0 +pytest-base-url==1.4.2 # via # -r requirements/test.txt # pytest-selenium pytest-cov==5.0.0 # via -r requirements/test.txt -pytest-django==4.8.0 +pytest-django==4.5.2 # via -r requirements/test.txt -pytest-html==4.1.1 +pytest-html==3.2.0 # via # -r requirements/test.txt # pytest-selenium -pytest-metadata==3.1.1 +pytest-metadata==2.0.4 # via # -r requirements/test.txt # pytest-html pytest-randomly==3.15.0 # via -r requirements/test.txt -pytest-selenium==2.0.1 +pytest-selenium==3.0.0 # via -r requirements/test.txt -pytest-timeout==2.3.1 +pytest-timeout==2.2.0 # via -r requirements/test.txt -pytest-variables==2.0.0 +pytest-variables==1.9.0 # via # -r requirements/test.txt # pytest-selenium @@ -826,6 +872,10 @@ python-mimeparse==1.6.0 # via # -r requirements/test.txt # cybersource-rest-client-python +python-slugify==8.0.4 + # via + # -r requirements/test.txt + # code-annotations python-subunit==1.4.4 # via # -r requirements/test.txt @@ -855,6 +905,7 @@ pywatchman==2.0.0 pyyaml==6.0.1 # via # -r requirements/test.txt + # code-annotations # cybersource-rest-client-python # drf-yasg # edx-django-release-util @@ -874,7 +925,7 @@ referencing==0.35.1 # -r requirements/test.txt # jsonschema # jsonschema-specifications -requests==2.31.0 +requests==2.32.2 # via # -r requirements/docs.txt # -r requirements/test.txt @@ -899,7 +950,7 @@ requests==2.31.0 # sphinx # stripe # zeep -requests-file==2.0.0 +requests-file==2.1.0 # via # -r requirements/test.txt # zeep @@ -918,7 +969,7 @@ rjsmin==1.2.1 # via # -r requirements/test.txt # django-compressor -rpds-py==0.18.0 +rpds-py==0.18.1 # via # -r requirements/test.txt # jsonschema @@ -930,7 +981,7 @@ rsa==4.9 # google-auth # inapppy # oauth2client -rules==3.3 +rules==3.4 # via -r requirements/test.txt s3transfer==0.10.1 # via @@ -939,6 +990,7 @@ s3transfer==0.10.1 selenium==3.141.0 # via # -r requirements/test.txt + # needle # pytest-selenium semantic-version==2.10.0 # via @@ -960,6 +1012,7 @@ six==1.16.0 # edx-auth-backends # edx-django-release-util # edx-ecommerce-worker + # edx-lint # edx-rbac # isodate # oauth2client @@ -1034,9 +1087,10 @@ sqlparse==0.5.0 stevedore==5.2.0 # via # -r requirements/test.txt + # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.4.0 +stripe==9.7.0 # via -r requirements/test.txt tenacity==6.3.1 # via @@ -1049,16 +1103,24 @@ testtools==2.7.1 # -r requirements/test.txt # cybersource-rest-client-python # python-subunit +text-unidecode==1.3 + # via + # -r requirements/test.txt + # python-slugify toml==0.10.2 # via # -r requirements/test.txt - # pylint + # pytest # tox tomli==2.0.1 # via # -r requirements/test.txt # coverage - # pytest + # pylint +tomlkit==0.12.5 + # via + # -r requirements/test.txt + # pylint tox==3.14.6 # via # -r requirements/test.txt @@ -1115,7 +1177,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==16.7.9 +virtualenv==20.26.2 # via # -r requirements/test.txt # tox @@ -1143,10 +1205,6 @@ wheel==0.43.0 # via # -r requirements/test.txt # cybersource-rest-client-python -wrapt==1.13.3 - # via - # -r requirements/test.txt - # astroid x509==0.1 # via # -r requirements/test.txt @@ -1159,13 +1217,13 @@ yarl==1.9.4 # aiohttp zeep==4.2.1 # via -r requirements/test.txt -zipp==3.18.1 +zipp==3.18.2 # via # -r requirements/docs.txt # -r requirements/test.txt # importlib-metadata # importlib-resources -zope-interface==6.3 +zope-interface==6.4.post1 # via # -r requirements/test.txt # cybersource-rest-client-python diff --git a/requirements/docs.txt b/requirements/docs.txt index 33ba2bc0f4f..1acc36c0730 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -5,10 +5,12 @@ # make upgrade # accessible-pygments==0.0.4 - # via pydata-sphinx-theme + # via + # -c requirements/constraints.txt + # pydata-sphinx-theme alabaster==0.7.13 # via sphinx -babel==2.14.0 +babel==2.15.0 # via # pydata-sphinx-theme # sphinx @@ -30,7 +32,7 @@ imagesize==1.4.1 # via sphinx importlib-metadata==7.1.0 # via sphinx -jinja2==3.1.3 +jinja2==3.1.4 # via sphinx markupsafe==2.1.5 # via jinja2 @@ -40,15 +42,17 @@ packaging==24.0 # sphinx pydata-sphinx-theme==0.14.4 # via sphinx-book-theme -pygments==2.17.2 +pygments==2.18.0 # via # accessible-pygments # pydata-sphinx-theme # sphinx pytz==2024.1 # via babel -requests==2.31.0 - # via sphinx +requests==2.32.2 + # via + # -c requirements/constraints.txt + # sphinx snowballstemmer==2.2.0 # via sphinx soupsieve==2.5 @@ -78,5 +82,5 @@ urllib3==1.26.18 # via # -c requirements/constraints.txt # requests -zipp==3.18.1 +zipp==3.18.2 # via importlib-metadata diff --git a/requirements/e2e.txt b/requirements/e2e.txt index 1261c29ebfa..7c6fb130fe4 100644 --- a/requirements/e2e.txt +++ b/requirements/e2e.txt @@ -8,6 +8,10 @@ asgiref==3.8.1 # via # -c requirements/base.txt # django +attrs==23.2.0 + # via + # -c requirements/base.txt + # pytest certifi==2024.2.2 # via # -c requirements/base.txt @@ -39,16 +43,14 @@ django-waffle==4.1.0 # via # -c requirements/base.txt # edx-django-utils -edx-django-utils==5.13.0 +edx-django-utils==5.14.1 # via # -c requirements/base.txt # edx-rest-api-client -edx-rest-api-client==5.7.0 +edx-rest-api-client==5.6.1 # via # -c requirements/base.txt # -r requirements/e2e.in -exceptiongroup==1.2.1 - # via pytest future==1.0.0 # via pyjwkest idna==2.7 @@ -62,15 +64,7 @@ importlib-metadata==7.1.0 # pytest-randomly iniconfig==2.0.0 # via pytest -jinja2==3.1.3 - # via - # -c requirements/base.txt - # pytest-html -markupsafe==2.1.5 - # via - # -c requirements/base.txt - # jinja2 -newrelic==9.9.0 +newrelic==9.9.1 # via # -c requirements/base.txt # edx-django-utils @@ -90,6 +84,10 @@ psutil==5.9.8 # via # -c requirements/base.txt # edx-django-utils +py==1.11.0 + # via + # pytest + # pytest-html pycparser==2.22 # via # -c requirements/base.txt @@ -108,7 +106,7 @@ pynacl==1.5.0 # via # -c requirements/base.txt # edx-django-utils -pytest==7.4.4 +pytest==6.2.5 # via # -r requirements/e2e.in # pytest-base-url @@ -118,21 +116,21 @@ pytest==7.4.4 # pytest-selenium # pytest-timeout # pytest-variables -pytest-base-url==2.1.0 +pytest-base-url==1.4.2 # via pytest-selenium -pytest-html==4.1.1 +pytest-html==3.2.0 # via pytest-selenium -pytest-metadata==3.1.1 +pytest-metadata==2.0.4 # via pytest-html pytest-randomly==3.15.0 # via -r requirements/e2e.in -pytest-selenium==2.0.1 +pytest-selenium==3.0.0 # via # -c requirements/constraints.txt # -r requirements/e2e.in -pytest-timeout==2.3.1 +pytest-timeout==2.2.0 # via -r requirements/e2e.in -pytest-variables==2.0.0 +pytest-variables==1.9.0 # via # -c requirements/constraints.txt # pytest-selenium @@ -142,9 +140,10 @@ pytz==2024.1 # via # -c requirements/base.txt # django -requests==2.31.0 +requests==2.32.2 # via # -c requirements/base.txt + # -c requirements/constraints.txt # edx-rest-api-client # pyjwkest # pytest-base-url @@ -152,6 +151,7 @@ requests==2.31.0 # slumber selenium==3.141.0 # via + # -c requirements/base.txt # -c requirements/constraints.txt # -r requirements/e2e.in # pytest-selenium @@ -174,7 +174,7 @@ stevedore==5.2.0 # edx-django-utils tenacity==6.3.1 # via pytest-selenium -tomli==2.0.1 +toml==0.10.2 # via pytest typing-extensions==4.11.0 # via @@ -186,7 +186,7 @@ urllib3==1.26.18 # -c requirements/constraints.txt # requests # selenium -zipp==3.18.1 +zipp==3.18.2 # via # -c requirements/base.txt # importlib-metadata diff --git a/requirements/pip.txt b/requirements/pip.txt index e3ffcc7b6da..8a72bb0b5e3 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -10,5 +10,5 @@ wheel==0.43.0 # The following packages are considered to be unsafe in a requirements file: pip==24.0 # via -r requirements/pip.in -setuptools==69.5.1 +setuptools==70.0.0 # via -r requirements/pip.in diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt index 858719e3767..0ae0a48cd90 100644 --- a/requirements/pip_tools.txt +++ b/requirements/pip_tools.txt @@ -24,7 +24,7 @@ tomli==2.0.1 # pip-tools wheel==0.43.0 # via pip-tools -zipp==3.18.1 +zipp==3.18.2 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/production.in b/requirements/production.in index c485b80a968..2fa07274608 100644 --- a/requirements/production.in +++ b/requirements/production.in @@ -3,7 +3,9 @@ -r base.in django-ses +edx-lint gunicorn==19.7.1 +needle newrelic python-memcached==1.59 PyYAML diff --git a/requirements/production.txt b/requirements/production.txt index 08b200d011d..8ee56f70df8 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -20,6 +20,11 @@ asgiref==3.8.1 # django-cors-headers asn1crypto==1.5.1 # via cybersource-rest-client-python +astroid==3.2.2 + # via + # -c requirements/constraints.txt + # pylint + # pylint-celery async-timeout==4.0.3 # via # aiohttp @@ -30,7 +35,7 @@ attrs==23.2.0 # jsonschema # referencing # zeep -babel==2.14.0 +babel==2.15.0 # via django-oscar backoff==1.10.0 # via analytics-python @@ -40,7 +45,7 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9" # celery # djangorestframework # kombu -bcrypt==4.1.2 +bcrypt==4.1.3 # via # cybersource-rest-client-python # paramiko @@ -48,11 +53,11 @@ billiard==4.2.0 # via celery bleach==6.1.0 # via -r requirements/base.in -boto3==1.34.96 +boto3==1.34.111 # via # -r requirements/base.in # django-ses -botocore==1.34.96 +botocore==1.34.111 # via # boto3 # s3transfer @@ -80,28 +85,35 @@ click==8.1.7 # via # celery # click-didyoumean + # click-log # click-plugins # click-repl + # code-annotations # edx-django-utils + # edx-lint click-didyoumean==0.3.1 # via celery +click-log==0.4.0 + # via edx-lint click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery +code-annotations==1.8.0 + # via edx-lint configparser==7.0.0 # via cybersource-rest-client-python coreapi==2.3.3 # via -r requirements/base.in coreschema==0.0.4 # via coreapi -coverage==7.5.0 +coverage==7.5.1 # via cybersource-rest-client-python crispy-bootstrap3==2024.1 # via -r requirements/base.in crypto==1.4.1 # via cybersource-rest-client-python -cryptography==42.0.5 +cryptography==42.0.7 # via # app-store-notifications-v2-validator # cybersource-rest-client-python @@ -111,7 +123,7 @@ cryptography==42.0.5 # social-auth-core cssselect==1.2.0 # via premailer -cssutils==2.10.2 +cssutils==2.11.0 # via premailer cybersource-rest-client-python==0.0.21 # via @@ -123,6 +135,8 @@ defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core +dill==0.3.8 + # via pylint django==3.2.25 # via # -c requirements/common_constraints.txt @@ -186,15 +200,15 @@ django-haystack==3.3b2 # via django-oscar django-libsass==0.9 # via -r requirements/base.in -django-model-utils==4.5.0 +django-model-utils==4.5.1 # via edx-rbac -django-oscar==3.2 +django-oscar==3.2.4 # via # -c requirements/constraints.txt # -r requirements/base.in django-phonenumber-field==6.4.0 # via django-oscar -django-ses==4.0.0 +django-ses==4.1.0 # via -r requirements/production.in django-simple-history==3.0.0 # via @@ -245,7 +259,7 @@ edx-django-release-util==1.4.0 # via -r requirements/base.in edx-django-sites-extensions==4.2.0 # via -r requirements/base.in -edx-django-utils==5.13.0 +edx-django-utils==5.14.1 # via # -r requirements/base.in # django-config-models @@ -258,13 +272,18 @@ edx-drf-extensions==10.3.0 # edx-rbac edx-ecommerce-worker==3.3.4 # via -r requirements/base.in +edx-lint==5.3.6 + # via + # -c requirements/constraints.txt + # -r requirements/base.in + # -r requirements/production.in edx-opaque-keys==2.9.0 # via # -r requirements/base.in # edx-drf-extensions edx-rbac==1.9.0 # via -r requirements/base.in -edx-rest-api-client==5.7.0 +edx-rest-api-client==5.6.1 # via # -r requirements/base.in # edx-ecommerce-worker @@ -274,7 +293,7 @@ extras==1.0.0 # via cybersource-rest-client-python factory-boy==3.2.1 # via django-oscar -faker==25.0.0 +faker==25.2.0 # via factory-boy fixtures==4.1.0 # via cybersource-rest-client-python @@ -331,10 +350,14 @@ iso8601==2.1.0 # via python-subunit isodate==0.6.1 # via zeep +isort==5.13.2 + # via pylint itypes==1.2.0 # via coreapi -jinja2==3.1.3 - # via coreschema +jinja2==3.1.4 + # via + # code-annotations + # coreschema jmespath==1.0.1 # via # boto3 @@ -359,7 +382,7 @@ linecache2==1.0.0 # traceback2 logger==1.4 # via cybersource-rest-client-python -lxml[html-clean,html_clean]==5.2.1 +lxml[html-clean,html_clean]==5.2.2 # via # -r requirements/base.in # lxml-html-clean @@ -371,13 +394,15 @@ markdown==3.4.3 # via -r requirements/base.in markupsafe==2.1.5 # via jinja2 +mccabe==0.7.0 + # via pylint monotonic==1.6 # via analytics-python multidict==6.0.5 # via # aiohttp # yarl -mysqlclient==1.4.6 +mysqlclient==2.2.4 # via -r requirements/base.in naked==0.1.32 # via @@ -385,7 +410,12 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/base.in -newrelic==9.9.0 +needle==0.5.0 + # via + # -c requirements/constraints.txt + # -r requirements/base.in + # -r requirements/production.in +newrelic==9.9.1 # via # -r requirements/base.in # -r requirements/production.in @@ -393,7 +423,9 @@ newrelic==9.9.0 nodeenv==1.1.1 # via -r requirements/production.in nose==1.3.7 - # via cybersource-rest-client-python + # via + # cybersource-rest-client-python + # needle oauth2client==4.1.3 # via inapppy oauthlib==3.2.2 @@ -418,14 +450,18 @@ pbr==6.0.0 # cybersource-rest-client-python # fixtures # stevedore -phonenumbers==8.13.35 +phonenumbers==8.13.37 # via django-oscar pillow==10.3.0 - # via django-oscar + # via + # django-oscar + # needle pkgutil-resolve-name==1.3.10 # via jsonschema -platformdirs==4.2.1 - # via zeep +platformdirs==4.2.2 + # via + # pylint + # zeep premailer==2.9.2 # via -r requirements/base.in prompt-toolkit==3.0.43 @@ -464,7 +500,7 @@ pycryptodome==3.20.0 # via cybersource-rest-client-python pycryptodomex==3.20.0 # via cybersource-rest-client-python -pygments==2.17.2 +pygments==2.18.0 # via -r requirements/base.in pyjwt[crypto]==2.8.0 # via @@ -475,6 +511,21 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-rest-api-client # social-auth-core +pylint==3.2.2 + # via + # -c requirements/constraints.txt + # edx-lint + # pylint-celery + # pylint-django + # pylint-plugin-utils +pylint-celery==0.3 + # via edx-lint +pylint-django==2.5.5 + # via edx-lint +pylint-plugin-utils==0.8.2 + # via + # pylint-celery + # pylint-django pymongo==4.4.0 # via edx-opaque-keys pynacl==1.5.0 @@ -503,6 +554,8 @@ python-memcached==1.59 # via -r requirements/production.in python-mimeparse==1.6.0 # via cybersource-rest-client-python +python-slugify==8.0.4 + # via code-annotations python-subunit==1.4.4 # via cybersource-rest-client-python python-toolbox==1.0.11 @@ -526,6 +579,7 @@ pytz==2024.1 pyyaml==6.0.1 # via # -r requirements/production.in + # code-annotations # cybersource-rest-client-python # drf-yasg # edx-django-release-util @@ -540,8 +594,9 @@ referencing==0.35.1 # via # jsonschema # jsonschema-specifications -requests==2.31.0 +requests==2.32.2 # via + # -c requirements/constraints.txt # -r requirements/base.in # analytics-python # coreapi @@ -559,7 +614,7 @@ requests==2.31.0 # social-auth-core # stripe # zeep -requests-file==2.0.0 +requests-file==2.1.0 # via zeep requests-oauthlib==2.0.0 # via @@ -569,7 +624,7 @@ requests-toolbelt==1.0.0 # via zeep rjsmin==1.2.1 # via django-compressor -rpds-py==0.18.0 +rpds-py==0.18.1 # via # jsonschema # referencing @@ -579,10 +634,14 @@ rsa==4.9 # google-auth # inapppy # oauth2client -rules==3.3 +rules==3.4 # via -r requirements/base.in s3transfer==0.10.1 # via boto3 +selenium==3.141.0 + # via + # -c requirements/constraints.txt + # needle semantic-version==2.10.0 # via edx-drf-extensions shellescape==3.8.1 @@ -599,6 +658,7 @@ six==1.16.0 # edx-auth-backends # edx-django-release-util # edx-ecommerce-worker + # edx-lint # edx-rbac # isodate # oauth2client @@ -623,14 +683,21 @@ sqlparse==0.5.0 # via django stevedore==5.2.0 # via + # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.4.0 +stripe==9.7.0 # via -r requirements/base.in testtools==2.7.1 # via # cybersource-rest-client-python # python-subunit +text-unidecode==1.3 + # via python-slugify +tomli==2.0.1 + # via pylint +tomlkit==0.12.5 + # via pylint traceback2==1.4.0 # via cybersource-rest-client-python typing==3.7.4.3 @@ -638,8 +705,10 @@ typing==3.7.4.3 typing-extensions==4.11.0 # via # asgiref + # astroid # edx-opaque-keys # kombu + # pylint # stripe tzdata==2024.1 # via @@ -658,6 +727,7 @@ urllib3==1.26.18 # botocore # cybersource-rest-client-python # requests + # selenium vine==5.1.0 # via # amqp @@ -677,11 +747,11 @@ yarl==1.9.4 # via aiohttp zeep==4.2.1 # via -r requirements/base.in -zipp==3.18.1 +zipp==3.18.2 # via # importlib-metadata # importlib-resources -zope-interface==6.3 +zope-interface==6.4.post1 # via # cybersource-rest-client-python # datetime diff --git a/requirements/test.in b/requirements/test.in index 6d36ce4b1a9..6b7a81f6a2d 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -3,11 +3,13 @@ -r e2e.txt # required for quality -r tox.txt +astroid==3.2.2 coverage ddt diff-cover django-webtest edx-i18n-tools # required for quality +edx-lint factory-boy freezegun isort diff --git a/requirements/test.txt b/requirements/test.txt index 53df258e568..007ac44deb7 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -30,8 +30,13 @@ asn1crypto==1.5.1 # via # -r requirements/base.txt # cybersource-rest-client-python -astroid==2.9.3 - # via pylint +astroid==3.2.2 + # via + # -c requirements/constraints.txt + # -r requirements/base.txt + # -r requirements/test.in + # pylint + # pylint-celery async-timeout==4.0.3 # via # -r requirements/base.txt @@ -40,11 +45,13 @@ async-timeout==4.0.3 attrs==23.2.0 # via # -r requirements/base.txt + # -r requirements/e2e.txt # aiohttp # jsonschema + # pytest # referencing # zeep -babel==2.14.0 +babel==2.15.0 # via # -r requirements/base.txt # django-oscar @@ -59,7 +66,7 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9" # celery # djangorestframework # kombu -bcrypt==4.1.2 +bcrypt==4.1.3 # via # -r requirements/base.txt # cybersource-rest-client-python @@ -72,9 +79,9 @@ billiard==4.2.0 # celery bleach==6.1.0 # via -r requirements/base.txt -boto3==1.34.96 +boto3==1.34.111 # via -r requirements/base.txt -botocore==1.34.96 +botocore==1.34.111 # via # -r requirements/base.txt # boto3 @@ -118,13 +125,20 @@ click==8.1.7 # -r requirements/e2e.txt # celery # click-didyoumean + # click-log # click-plugins # click-repl + # code-annotations # edx-django-utils + # edx-lint click-didyoumean==0.3.1 # via # -r requirements/base.txt # celery +click-log==0.4.0 + # via + # -r requirements/base.txt + # edx-lint click-plugins==1.1.1 # via # -r requirements/base.txt @@ -133,6 +147,10 @@ click-repl==0.3.0 # via # -r requirements/base.txt # celery +code-annotations==1.8.0 + # via + # -r requirements/base.txt + # edx-lint configparser==7.0.0 # via # -r requirements/base.txt @@ -143,7 +161,7 @@ coreschema==0.0.4 # via # -r requirements/base.txt # coreapi -coverage[toml]==7.5.0 +coverage[toml]==7.5.1 # via # -r requirements/base.txt # -r requirements/test.in @@ -155,7 +173,7 @@ crypto==1.4.1 # via # -r requirements/base.txt # cybersource-rest-client-python -cryptography==42.0.5 +cryptography==42.0.7 # via # -r requirements/base.txt # app-store-notifications-v2-validator @@ -168,7 +186,7 @@ cssselect==1.2.0 # via # -r requirements/base.txt # premailer -cssutils==2.10.2 +cssutils==2.11.0 # via # -r requirements/base.txt # premailer @@ -187,8 +205,16 @@ defusedxml==0.8.0rc2 # -r requirements/base.txt # python3-openid # social-auth-core -diff-cover==7.7.0 +diff-cover==9.0.0 # via -r requirements/test.in +dill==0.3.8 + # via + # -r requirements/base.txt + # pylint +distlib==0.3.8 + # via + # -r requirements/tox.txt + # virtualenv # via # -c requirements/common_constraints.txt # -r requirements/base.txt @@ -260,11 +286,11 @@ django-haystack==3.3b2 # django-oscar django-libsass==0.9 # via -r requirements/base.txt -django-model-utils==4.5.0 +django-model-utils==4.5.1 # via # -r requirements/base.txt # edx-rbac -django-oscar==3.2 +django-oscar==3.2.4 # via # -c requirements/constraints.txt # -r requirements/base.txt @@ -336,7 +362,7 @@ edx-django-release-util==1.4.0 # via -r requirements/base.txt edx-django-sites-extensions==4.2.0 # via -r requirements/base.txt -edx-django-utils==5.13.0 +edx-django-utils==5.14.1 # via # -r requirements/base.txt # -r requirements/e2e.txt @@ -352,13 +378,18 @@ edx-ecommerce-worker==3.3.4 # via -r requirements/base.txt edx-i18n-tools==1.6.0 # via -r requirements/test.in +edx-lint==5.3.6 + # via + # -c requirements/constraints.txt + # -r requirements/base.txt + # -r requirements/test.in edx-opaque-keys==2.9.0 # via # -r requirements/base.txt # edx-drf-extensions edx-rbac==1.9.0 # via -r requirements/base.txt -edx-rest-api-client==5.7.0 +edx-rest-api-client==5.6.1 # via # -r requirements/base.txt # -r requirements/e2e.txt @@ -367,10 +398,6 @@ enum34==1.1.10 # via # -r requirements/base.txt # cybersource-rest-client-python -exceptiongroup==1.2.1 - # via - # -r requirements/e2e.txt - # pytest extras==1.0.0 # via # -r requirements/base.txt @@ -380,7 +407,7 @@ factory-boy==3.2.1 # -r requirements/base.txt # -r requirements/test.in # django-oscar -faker==25.0.0 +faker==25.2.0 # via # -r requirements/base.txt # factory-boy @@ -388,11 +415,12 @@ filelock==3.14.0 # via # -r requirements/tox.txt # tox + # virtualenv fixtures==4.1.0 # via # -r requirements/base.txt # cybersource-rest-client-python -freezegun==1.5.0 +freezegun==1.5.1 # via -r requirements/test.in frozenlist==1.4.1 # via @@ -480,19 +508,19 @@ isodate==0.6.1 # zeep isort==5.13.2 # via + # -r requirements/base.txt # -r requirements/test.in # pylint itypes==1.2.0 # via # -r requirements/base.txt # coreapi -jinja2==3.1.3 +jinja2==3.1.4 # via # -r requirements/base.txt - # -r requirements/e2e.txt + # code-annotations # coreschema # diff-cover - # pytest-html jmespath==1.0.1 # via # -r requirements/base.txt @@ -514,8 +542,6 @@ kombu==5.3.7 # via # -r requirements/base.txt # celery -lazy-object-proxy==1.10.0 - # via astroid libsass==0.23.0 # via # -r requirements/base.txt @@ -529,7 +555,7 @@ logger==1.4 # via # -r requirements/base.txt # cybersource-rest-client-python -lxml[html-clean]==5.2.1 +lxml[html-clean]==5.2.2 # via # -r requirements/base.txt # -r requirements/test.in @@ -546,11 +572,10 @@ markdown==3.4.3 markupsafe==2.1.5 # via # -r requirements/base.txt - # -r requirements/e2e.txt # jinja2 -mccabe==0.6.1 +mccabe==0.7.0 # via - # -c requirements/constraints.txt + # -r requirements/base.txt # pylint mock==5.1.0 # via -r requirements/test.in @@ -563,7 +588,7 @@ multidict==6.0.5 # -r requirements/base.txt # aiohttp # yarl -mysqlclient==1.4.6 +mysqlclient==2.2.4 # via -r requirements/base.txt naked==0.1.32 # via @@ -572,7 +597,11 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/base.txt -newrelic==9.9.0 +needle==0.5.0 + # via + # -c requirements/constraints.txt + # -r requirements/base.txt +newrelic==9.9.1 # via # -r requirements/base.txt # -r requirements/e2e.txt @@ -581,6 +610,7 @@ nose==1.3.7 # via # -r requirements/base.txt # cybersource-rest-client-python + # needle oauth2client==4.1.3 # via # -r requirements/base.txt @@ -619,7 +649,7 @@ pbr==6.0.0 # cybersource-rest-client-python # fixtures # stevedore -phonenumbers==8.13.35 +phonenumbers==8.13.37 # via # -r requirements/base.txt # django-oscar @@ -627,14 +657,17 @@ pillow==10.3.0 # via # -r requirements/base.txt # django-oscar + # needle pkgutil-resolve-name==1.3.10 # via # -r requirements/base.txt # jsonschema -platformdirs==4.2.1 +platformdirs==4.2.2 # via # -r requirements/base.txt + # -r requirements/tox.txt # pylint + # virtualenv # zeep pluggy==0.13.1 # via @@ -673,7 +706,10 @@ purl==1.6 # django-oscar py==1.11.0 # via + # -r requirements/e2e.txt # -r requirements/tox.txt + # pytest + # pytest-html # tox pyasn1==0.6.0 # via @@ -710,7 +746,7 @@ pycryptodomex==3.20.0 # -r requirements/e2e.txt # cybersource-rest-client-python # pyjwkest -pygments==2.17.2 +pygments==2.18.0 # via # -r requirements/base.txt # diff-cover @@ -727,10 +763,28 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-rest-api-client # social-auth-core -pylint==2.12.2 +pylint==3.2.2 # via # -c requirements/constraints.txt + # -r requirements/base.txt # -r requirements/test.in + # edx-lint + # pylint-celery + # pylint-django + # pylint-plugin-utils +pylint-celery==0.3 + # via + # -r requirements/base.txt + # edx-lint +pylint-django==2.5.5 + # via + # -r requirements/base.txt + # edx-lint +pylint-plugin-utils==0.8.2 + # via + # -r requirements/base.txt + # pylint-celery + # pylint-django pymongo==4.4.0 # via # -r requirements/base.txt @@ -757,7 +811,7 @@ pypi==2.1 # via # -r requirements/base.txt # cybersource-rest-client-python -pytest==7.4.4 +pytest==6.2.5 # via # -r requirements/e2e.txt # -r requirements/test.in @@ -770,31 +824,31 @@ pytest==7.4.4 # pytest-selenium # pytest-timeout # pytest-variables -pytest-base-url==2.1.0 +pytest-base-url==1.4.2 # via # -r requirements/e2e.txt # pytest-selenium pytest-cov==5.0.0 # via -r requirements/test.in -pytest-django==4.8.0 +pytest-django==4.5.2 # via -r requirements/test.in -pytest-html==4.1.1 +pytest-html==3.2.0 # via # -r requirements/e2e.txt # pytest-selenium -pytest-metadata==3.1.1 +pytest-metadata==2.0.4 # via # -r requirements/e2e.txt # pytest-html pytest-randomly==3.15.0 # via -r requirements/e2e.txt -pytest-selenium==2.0.1 +pytest-selenium==3.0.0 # via # -c requirements/constraints.txt # -r requirements/e2e.txt -pytest-timeout==2.3.1 +pytest-timeout==2.2.0 # via -r requirements/e2e.txt -pytest-variables==2.0.0 +pytest-variables==1.9.0 # via # -c requirements/constraints.txt # -r requirements/e2e.txt @@ -815,6 +869,10 @@ python-mimeparse==1.6.0 # via # -r requirements/base.txt # cybersource-rest-client-python +python-slugify==8.0.4 + # via + # -r requirements/base.txt + # code-annotations python-subunit==1.4.4 # via # -r requirements/base.txt @@ -842,6 +900,7 @@ pytz==2024.1 pyyaml==6.0.1 # via # -r requirements/base.txt + # code-annotations # cybersource-rest-client-python # drf-yasg # edx-django-release-util @@ -861,8 +920,9 @@ referencing==0.35.1 # -r requirements/base.txt # jsonschema # jsonschema-specifications -requests==2.31.0 +requests==2.32.2 # via + # -c requirements/constraints.txt # -r requirements/base.txt # -r requirements/e2e.txt # analytics-python @@ -885,7 +945,7 @@ requests==2.31.0 # social-auth-core # stripe # zeep -requests-file==2.0.0 +requests-file==2.1.0 # via # -r requirements/base.txt # zeep @@ -904,7 +964,7 @@ rjsmin==1.2.1 # via # -r requirements/base.txt # django-compressor -rpds-py==0.18.0 +rpds-py==0.18.1 # via # -r requirements/base.txt # jsonschema @@ -916,7 +976,7 @@ rsa==4.9 # google-auth # inapppy # oauth2client -rules==3.3 +rules==3.4 # via -r requirements/base.txt s3transfer==0.10.1 # via @@ -925,8 +985,10 @@ s3transfer==0.10.1 selenium==3.141.0 # via # -c requirements/constraints.txt + # -r requirements/base.txt # -r requirements/e2e.txt # -r requirements/test.in + # needle # pytest-selenium semantic-version==2.10.0 # via @@ -950,6 +1012,7 @@ six==1.16.0 # edx-auth-backends # edx-django-release-util # edx-ecommerce-worker + # edx-lint # edx-rbac # isodate # oauth2client @@ -988,9 +1051,10 @@ stevedore==5.2.0 # via # -r requirements/base.txt # -r requirements/e2e.txt + # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.4.0 +stripe==9.7.0 # via -r requirements/base.txt tenacity==6.3.1 # via @@ -1003,16 +1067,25 @@ testtools==2.7.1 # -r requirements/base.txt # cybersource-rest-client-python # python-subunit +text-unidecode==1.3 + # via + # -r requirements/base.txt + # python-slugify toml==0.10.2 # via + # -r requirements/e2e.txt # -r requirements/tox.txt - # pylint + # pytest # tox tomli==2.0.1 # via - # -r requirements/e2e.txt + # -r requirements/base.txt # coverage - # pytest + # pylint +tomlkit==0.12.5 + # via + # -r requirements/base.txt + # pylint tox==3.14.6 # via # -c requirements/constraints.txt @@ -1067,7 +1140,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==16.7.9 +virtualenv==20.26.2 # via # -c requirements/constraints.txt # -r requirements/tox.txt @@ -1090,10 +1163,6 @@ wheel==0.43.0 # via # -r requirements/base.txt # cybersource-rest-client-python -wrapt==1.13.3 - # via - # -c requirements/constraints.txt - # astroid x509==0.1 # via # -r requirements/base.txt @@ -1106,13 +1175,13 @@ yarl==1.9.4 # aiohttp zeep==4.2.1 # via -r requirements/base.txt -zipp==3.18.1 +zipp==3.18.2 # via # -r requirements/base.txt # -r requirements/e2e.txt # importlib-metadata # importlib-resources -zope-interface==6.3 +zope-interface==6.4.post1 # via # -r requirements/base.txt # cybersource-rest-client-python diff --git a/requirements/tox.txt b/requirements/tox.txt index 7d48facdbc5..6426b2a6348 100644 --- a/requirements/tox.txt +++ b/requirements/tox.txt @@ -4,10 +4,16 @@ # # make upgrade # +distlib==0.3.8 + # via virtualenv filelock==3.14.0 - # via tox + # via + # tox + # virtualenv packaging==24.0 # via tox +platformdirs==4.2.2 + # via virtualenv pluggy==0.13.1 # via # -c requirements/constraints.txt @@ -25,7 +31,7 @@ tox==3.14.6 # tox-battery tox-battery==0.6.2 # via -r requirements/tox.in -virtualenv==16.7.9 +virtualenv==20.26.2 # via # -c requirements/constraints.txt # tox diff --git a/tox.ini b/tox.ini index c84ff81e9a2..f831eb3d4e1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] skipsdist=True -envlist = py38-django32-{static,pylint,tests,theme_static,check_keywords},py38-{isort,pycodestyle,extract_translations,dummy_translations,compile_translations, detect_changed_translations,validate_translations},docs +envlist = py{38, 311, 312}-django32-{static,pylint,tests,theme_static,check_keywords},py{38, 311, 312}-{isort,pycodestyle,extract_translations,dummy_translations,compile_translations, detect_changed_translations,validate_translations},docs [pytest] addopts = --ds=ecommerce.settings.test --cov=ecommerce --cov-report term --cov-config=.coveragerc --no-cov-on-fail -p no:randomly --no-migrations -m "not acceptance" @@ -13,6 +13,8 @@ envdir= # Use the same environment for all commands running under a specific python version py35: {toxworkdir}/py35 py38: {toxworkdir}/py38 + py311: {toxworkdir}/py311 + py312: {toxworkdir}/py312 passenv = CONN_MAX_AGE DB_ENGINE From 323c407f716e39f14eb1910f59fc02e7613a7d72 Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Fri, 31 May 2024 12:58:08 +0500 Subject: [PATCH 2/4] fix: ci checks related to python tests pin django-oscar to 3.2, removed migrations, replace depreciated assertDictContainsSubset method with python code --- ecommerce/core/tests/test_models.py | 6 +- ecommerce/credit/tests/test_views.py | 15 ++++- ecommerce/enterprise/tests/test_utils.py | 6 +- .../basket/migrations/0018_line_tax_code.py | 18 ------ .../migrations/0058_auto_20240528_0754.py | 39 ----------- .../extensions/checkout/tests/test_views.py | 31 +++++++-- .../fulfillment/tests/test_modules.py | 8 ++- .../migrations/0056_auto_20240528_0754.py | 51 --------------- .../migrations/0029_auto_20240528_0754.py | 64 ------------------- .../tests/processors/test_cybersource.py | 6 +- .../extensions/voucher/tests/test_utils.py | 6 +- requirements/base.txt | 22 +++---- requirements/constraints.txt | 2 +- requirements/dev.txt | 22 +++---- requirements/docs.txt | 4 +- requirements/e2e.txt | 6 +- requirements/pip_tools.txt | 2 +- requirements/production.txt | 22 +++---- requirements/test.txt | 22 +++---- 19 files changed, 115 insertions(+), 237 deletions(-) delete mode 100644 ecommerce/extensions/basket/migrations/0018_line_tax_code.py delete mode 100644 ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py delete mode 100644 ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py delete mode 100644 ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py diff --git a/ecommerce/core/tests/test_models.py b/ecommerce/core/tests/test_models.py index 4dfe176199f..b4fcf286fcc 100644 --- a/ecommerce/core/tests/test_models.py +++ b/ecommerce/core/tests/test_models.py @@ -1,6 +1,7 @@ import json +import sys import ddt import mock @@ -177,7 +178,10 @@ def test_user_details_uses_jwt(self): # Verify the headers passed to the API were correct. expected = {'Authorization': 'JWT {}'.format(token), } - self.assertDictContainsSubset(expected, last_request.headers) + if sys.version_info > (3, 9): + self.assertLessEqual(expected.items(), last_request.headers.items()) + else: + self.assertDictContainsSubset(expected, last_request.headers) def test_no_user_details(self): """ Verify False is returned when there is a connection error. """ diff --git a/ecommerce/credit/tests/test_views.py b/ecommerce/credit/tests/test_views.py index 40f1eac27ec..f34e0a85dd5 100644 --- a/ecommerce/credit/tests/test_views.py +++ b/ecommerce/credit/tests/test_views.py @@ -2,7 +2,7 @@ Tests for the checkout page. """ - +import sys from datetime import timedelta import ddt @@ -130,7 +130,18 @@ def _assert_success_checkout_page(self, sku=None): response = self.client.get(self.path) self.assertEqual(response.status_code, 200) - self.assertDictContainsSubset({'course': self.course}, response.context) + if sys.version_info > (3, 9): + context = {} + for i, ctx in enumerate(response.context): + if isinstance(ctx, dict): + context.update(ctx) + elif hasattr(ctx, '__iter__') and not isinstance(ctx, str): + for item in ctx: + if isinstance(item, dict): + context.update(item) + self.assertLessEqual({'course': self.course}.items(), context.items()) + else: + self.assertDictContainsSubset({'course': self.course}, response.context) self.assertContains( response, diff --git a/ecommerce/enterprise/tests/test_utils.py b/ecommerce/enterprise/tests/test_utils.py index 1e10d88b313..ccae48c4b30 100644 --- a/ecommerce/enterprise/tests/test_utils.py +++ b/ecommerce/enterprise/tests/test_utils.py @@ -1,5 +1,6 @@ +import sys import uuid import ddt @@ -122,7 +123,10 @@ def test_post_enterprise_customer_user(self, mock_helpers, expected_return): self.learner.username ) - self.assertDictContainsSubset(expected_return, response) + if sys.version_info > (3, 9): + self.assertLessEqual(expected_return.items(), response.items()) + else: + self.assertDictContainsSubset(expected_return, response) @responses.activate def test_ecu_needs_consent(self): diff --git a/ecommerce/extensions/basket/migrations/0018_line_tax_code.py b/ecommerce/extensions/basket/migrations/0018_line_tax_code.py deleted file mode 100644 index 914ac028892..00000000000 --- a/ecommerce/extensions/basket/migrations/0018_line_tax_code.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.25 on 2024-05-28 07:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('basket', '0017_alter_lineattribute_value'), - ] - - operations = [ - migrations.AddField( - model_name='line', - name='tax_code', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), - ), - ] diff --git a/ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py b/ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py deleted file mode 100644 index b671354b457..00000000000 --- a/ecommerce/extensions/catalogue/migrations/0058_auto_20240528_0754.py +++ /dev/null @@ -1,39 +0,0 @@ -# Generated by Django 3.2.25 on 2024-05-28 07:54 - -from django.db import migrations -import oscar.models.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('catalogue', '0057_auto_20231205_1034'), - ] - - operations = [ - migrations.AddField( - model_name='attributeoption', - name='code', - field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Unique identifier'), - ), - migrations.AddField( - model_name='attributeoptiongroup', - name='code', - field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Unique identifier'), - ), - migrations.AddField( - model_name='category', - name='code', - field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Code'), - ), - migrations.AddField( - model_name='historicalcategory', - name='code', - field=oscar.models.fields.NullCharField(db_index=True, max_length=255, verbose_name='Code'), - ), - migrations.AddField( - model_name='productimage', - name='code', - field=oscar.models.fields.NullCharField(max_length=255, unique=True, verbose_name='Code'), - ), - ] diff --git a/ecommerce/extensions/checkout/tests/test_views.py b/ecommerce/extensions/checkout/tests/test_views.py index 79c120eb74b..311c9dbfa9a 100644 --- a/ecommerce/extensions/checkout/tests/test_views.py +++ b/ecommerce/extensions/checkout/tests/test_views.py @@ -1,5 +1,6 @@ +import sys from decimal import Decimal from urllib import parse @@ -338,7 +339,10 @@ def test_get_receipt_for_existing_order(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - self.assertDictContainsSubset(context_data, response.context_data) + if sys.version_info > (3, 9): + self.assertEqual(response.context_data, response.context_data | context_data) + else: + self.assertDictContainsSubset(context_data, response.context_data) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -371,7 +375,10 @@ def test_get_receipt_for_existing_entitlement_order(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - self.assertDictContainsSubset(context_data, response.context_data) + if sys.version_info > (3, 9): + self.assertEqual(response.context_data, response.context_data | context_data) + else: + self.assertDictContainsSubset(context_data, response.context_data) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -387,7 +394,10 @@ def test_get_receipt_for_existing_order_as_staff_user(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - self.assertDictContainsSubset(context_data, response.context_data) + if sys.version_info > (3, 9): + self.assertEqual(response.context_data, response.context_data | context_data) + else: + self.assertDictContainsSubset(context_data, response.context_data) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -400,7 +410,10 @@ def test_get_receipt_for_existing_order_user_not_owner(self, mock_learner_data): context_data = {'order_history_url': self.site.siteconfiguration.build_lms_url('account/settings')} self.assertEqual(response.status_code, 404) - self.assertDictContainsSubset(context_data, response.context_data) + if sys.version_info > (3, 9): + self.assertEqual(response.context_data, response.context_data | context_data) + else: + self.assertDictContainsSubset(context_data, response.context_data) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -456,7 +469,10 @@ def test_dashboard_link_for_course_purchase(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - self.assertDictContainsSubset(context_data, response.context_data) + if sys.version_info > (3, 9): + self.assertEqual(response.context_data, response.context_data | context_data) + else: + self.assertDictContainsSubset(context_data, response.context_data) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -482,7 +498,10 @@ def test_dashboard_link_for_bundle_purchase(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - self.assertDictContainsSubset(context_data, response.context_data) + if sys.version_info > (3, 9): + self.assertEqual(response.context_data, response.context_data | context_data) + else: + self.assertDictContainsSubset(context_data, response.context_data) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate diff --git a/ecommerce/extensions/fulfillment/tests/test_modules.py b/ecommerce/extensions/fulfillment/tests/test_modules.py index 0ee1d7b2fc9..880dcd077f3 100644 --- a/ecommerce/extensions/fulfillment/tests/test_modules.py +++ b/ecommerce/extensions/fulfillment/tests/test_modules.py @@ -3,6 +3,7 @@ import datetime import json +import sys import uuid from decimal import Decimal from urllib.parse import urlencode @@ -212,7 +213,10 @@ def test_enrollment_module_fulfill(self): 'X-Forwarded-For': self.user.tracking_context['lms_ip'], } - self.assertDictContainsSubset(expected_headers, actual_headers) + if sys.version_info > (3, 9): + self.assertLessEqual(expected_headers.items(), actual_headers.items()) + else: + self.assertDictContainsSubset(expected_headers, actual_headers) self.assertEqual(expected_body, actual_body) @responses.activate @@ -377,7 +381,7 @@ def test_revoke_product(self): 'X-Forwarded-For': self.user.tracking_context['lms_ip'], } - self.assertDictContainsSubset(expected_headers, actual_headers) + assert expected_headers.items() <= actual_headers.items() self.assertEqual(expected_body, actual_body) @responses.activate diff --git a/ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py b/ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py deleted file mode 100644 index 622374420bd..00000000000 --- a/ecommerce/extensions/offer/migrations/0056_auto_20240528_0754.py +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by Django 3.2.25 on 2024-05-28 07:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('offer', '0055_auto_20231108_1355'), - ] - - operations = [ - migrations.CreateModel( - name='FixedUnitDiscountBenefit', - fields=[ - ], - options={ - 'verbose_name': 'Fixed unit discount benefit', - 'verbose_name_plural': 'Fixed unit discount benefits', - 'proxy': True, - 'indexes': [], - 'constraints': [], - }, - bases=('offer.absolutediscountbenefit',), - ), - migrations.AddField( - model_name='rangeproductfileupload', - name='upload_type', - field=models.CharField(choices=[('included', 'Included products upload'), ('excluded', 'Excluded products upload')], default='included', max_length=8), - ), - migrations.AlterField( - model_name='benefit', - name='type', - field=models.CharField(blank=True, choices=[('Percentage', "Discount is a percentage off of the product's value"), ('Absolute', "Discount is a fixed amount off of the basket's total"), ('Fixed', "Discount is a fixed amount off of the product's value"), ('Multibuy', 'Discount is to give the cheapest product for free'), ('Fixed price', 'Get the products that meet the condition for a fixed price'), ('Shipping absolute', 'Discount is a fixed amount of the shipping cost'), ('Shipping fixed price', 'Get shipping for a fixed price'), ('Shipping percentage', 'Discount is a percentage off of the shipping cost')], max_length=128, verbose_name='Type'), - ), - migrations.AlterField( - model_name='historicalbenefit', - name='type', - field=models.CharField(blank=True, choices=[('Percentage', "Discount is a percentage off of the product's value"), ('Absolute', "Discount is a fixed amount off of the basket's total"), ('Fixed', "Discount is a fixed amount off of the product's value"), ('Multibuy', 'Discount is to give the cheapest product for free'), ('Fixed price', 'Get the products that meet the condition for a fixed price'), ('Shipping absolute', 'Discount is a fixed amount of the shipping cost'), ('Shipping fixed price', 'Get shipping for a fixed price'), ('Shipping percentage', 'Discount is a percentage off of the shipping cost')], max_length=128, verbose_name='Type'), - ), - migrations.AlterField( - model_name='historicalrange', - name='description', - field=models.TextField(blank=True, verbose_name='Description'), - ), - migrations.AlterField( - model_name='range', - name='description', - field=models.TextField(blank=True, verbose_name='Description'), - ), - ] diff --git a/ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py b/ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py deleted file mode 100644 index 1eec0476ee7..00000000000 --- a/ecommerce/extensions/order/migrations/0029_auto_20240528_0754.py +++ /dev/null @@ -1,64 +0,0 @@ -# Generated by Django 3.2.25 on 2024-05-28 07:54 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('order', '0028_alter_lineattribute_value'), - ] - - operations = [ - migrations.AlterModelOptions( - name='surcharge', - options={'ordering': ['pk'], 'verbose_name': 'Surcharge', 'verbose_name_plural': 'Surcharges'}, - ), - migrations.AddField( - model_name='historicalline', - name='tax_code', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), - ), - migrations.AddField( - model_name='historicalorder', - name='shipping_tax_code', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Shipping VAT rate code'), - ), - migrations.AddField( - model_name='line', - name='tax_code', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), - ), - migrations.AddField( - model_name='lineprice', - name='tax_code', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), - ), - migrations.AddField( - model_name='order', - name='shipping_tax_code', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Shipping VAT rate code'), - ), - migrations.AddField( - model_name='surcharge', - name='tax_code', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='VAT rate code'), - ), - migrations.CreateModel( - name='OrderLineDiscount', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('is_incl_tax', models.BooleanField()), - ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Line discount (excl. tax)')), - ('line', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='discounts', to='order.line', verbose_name='Line')), - ('order_discount', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='discount_lines', to='order.orderdiscount', verbose_name='Order discount')), - ], - options={ - 'verbose_name': 'Order line discount', - 'verbose_name_plural': 'Order line discounts', - 'ordering': ['pk'], - 'abstract': False, - }, - ), - ] diff --git a/ecommerce/extensions/payment/tests/processors/test_cybersource.py b/ecommerce/extensions/payment/tests/processors/test_cybersource.py index 6f7ea73f46b..fbdac1c3d9f 100644 --- a/ecommerce/extensions/payment/tests/processors/test_cybersource.py +++ b/ecommerce/extensions/payment/tests/processors/test_cybersource.py @@ -3,6 +3,7 @@ import json +import sys from decimal import Decimal from unittest import SkipTest @@ -49,7 +50,10 @@ def assert_processor_response_recorded(self, processor_name, transaction_id, res expected = { 'requestID': transaction_id, } - self.assertDictContainsSubset(expected, ppr.response) + if sys.version_info > (3, 9): + self.assertLessEqual(expected.items(), ppr.response.items()) + else: + self.assertDictContainsSubset(expected, ppr.response) self.assertEqual(ppr.basket, basket) return ppr.id diff --git a/ecommerce/extensions/voucher/tests/test_utils.py b/ecommerce/extensions/voucher/tests/test_utils.py index a96539e675f..e59dfa87339 100644 --- a/ecommerce/extensions/voucher/tests/test_utils.py +++ b/ecommerce/extensions/voucher/tests/test_utils.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- +import sys import uuid import ddt @@ -523,7 +524,10 @@ def test_generate_coupon_report_with_deleted_product(self): __, rows = generate_coupon_report([query_coupon.attr.coupon_vouchers]) self.assert_report_first_row(rows[0], query_coupon, first_voucher) - self.assertDictContainsSubset({'Redeemed For Course ID': 'Unknown'}, rows[2]) + if sys.version_info > (3, 9): + self.assertLessEqual({'Redeemed For Course ID': 'Unknown'}.items(), rows[2].items()) + else: + self.assertDictContainsSubset({'Redeemed For Course ID': 'Unknown'}, rows[2]) def test_report_for_inactive_coupons(self): """ Verify the coupon report show correct status for inactive coupons. """ diff --git a/requirements/base.txt b/requirements/base.txt index 8290ef0700f..4f1435dd396 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -53,9 +53,9 @@ billiard==4.2.0 # via celery bleach==6.1.0 # via -r requirements/base.in -boto3==1.34.111 +boto3==1.34.115 # via -r requirements/base.in -botocore==1.34.111 +botocore==1.34.115 # via # boto3 # s3transfer @@ -105,7 +105,7 @@ coreapi==2.3.3 # via -r requirements/base.in coreschema==0.0.4 # via coreapi -coverage==7.5.1 +coverage==7.5.3 # via cybersource-rest-client-python crispy-bootstrap3==2024.1 # via -r requirements/base.in @@ -199,7 +199,7 @@ django-libsass==0.9 # via -r requirements/base.in django-model-utils==4.5.1 # via edx-rbac -django-oscar==3.2.4 +django-oscar==3.2 # via # -c requirements/constraints.txt # -r requirements/base.in @@ -287,7 +287,7 @@ extras==1.0.0 # via cybersource-rest-client-python factory-boy==3.2.1 # via django-oscar -faker==25.2.0 +faker==25.3.0 # via factory-boy fixtures==4.1.0 # via cybersource-rest-client-python @@ -406,7 +406,7 @@ needle==0.5.0 # via # -c requirements/constraints.txt # -r requirements/base.in -newrelic==9.9.1 +newrelic==9.10.0 # via # -r requirements/base.in # edx-django-utils @@ -452,7 +452,7 @@ platformdirs==4.2.2 # zeep premailer==2.9.2 # via -r requirements/base.in -prompt-toolkit==3.0.43 +prompt-toolkit==3.0.45 # via click-repl proto-plus==1.23.0 # via google-api-core @@ -667,7 +667,7 @@ stevedore==5.2.0 # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.7.0 +stripe==9.8.0 # via -r requirements/base.in testtools==2.7.1 # via @@ -683,7 +683,7 @@ traceback2==1.4.0 # via cybersource-rest-client-python typing==3.7.4.3 # via cybersource-rest-client-python -typing-extensions==4.11.0 +typing-extensions==4.12.0 # via # asgiref # astroid @@ -728,11 +728,11 @@ yarl==1.9.4 # via aiohttp zeep==4.2.1 # via -r requirements/base.in -zipp==3.18.2 +zipp==3.19.0 # via # importlib-metadata # importlib-resources -zope-interface==6.4.post1 +zope-interface==6.4.post2 # via # cybersource-rest-client-python # datetime diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 1e560deead6..69ef8600885 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -15,7 +15,7 @@ cybersource-rest-client-python==0.0.21 # Django 3.2 support is added in version 2.2 so pinning it to 2.2 -django-oscar==3.2.4 +django-oscar==3.2 # Pinned because transifex-client==0.13.6 pins it urllib3>=1.24.2,<2.0.0 diff --git a/requirements/dev.txt b/requirements/dev.txt index 6c45e70ff5f..0f861f45694 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -90,9 +90,9 @@ billiard==4.2.0 # celery bleach==6.1.0 # via -r requirements/test.txt -boto3==1.34.111 +boto3==1.34.115 # via -r requirements/test.txt -botocore==1.34.111 +botocore==1.34.115 # via # -r requirements/test.txt # boto3 @@ -169,7 +169,7 @@ coreschema==0.0.4 # via # -r requirements/test.txt # coreapi -coverage[toml]==7.5.1 +coverage[toml]==7.5.3 # via # -r requirements/test.txt # cybersource-rest-client-python @@ -296,7 +296,7 @@ django-model-utils==4.5.1 # via # -r requirements/test.txt # edx-rbac -django-oscar==3.2.4 +django-oscar==3.2 # via -r requirements/test.txt django-phonenumber-field==6.4.0 # via @@ -409,7 +409,7 @@ factory-boy==3.2.1 # via # -r requirements/test.txt # django-oscar -faker==25.2.0 +faker==25.3.0 # via # -r requirements/test.txt # factory-boy @@ -606,7 +606,7 @@ needle==0.5.0 # via # -r requirements/dev.in # -r requirements/test.txt -newrelic==9.9.1 +newrelic==9.10.0 # via # -r requirements/test.txt # edx-django-utils @@ -686,7 +686,7 @@ polib==1.2.0 # edx-i18n-tools premailer==2.9.2 # via -r requirements/test.txt -prompt-toolkit==3.0.43 +prompt-toolkit==3.0.45 # via # -r requirements/test.txt # click-repl @@ -1090,7 +1090,7 @@ stevedore==5.2.0 # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.7.0 +stripe==9.8.0 # via -r requirements/test.txt tenacity==6.3.1 # via @@ -1137,7 +1137,7 @@ typing==3.7.4.3 # via # -r requirements/test.txt # cybersource-rest-client-python -typing-extensions==4.11.0 +typing-extensions==4.12.0 # via # -r requirements/docs.txt # -r requirements/test.txt @@ -1217,13 +1217,13 @@ yarl==1.9.4 # aiohttp zeep==4.2.1 # via -r requirements/test.txt -zipp==3.18.2 +zipp==3.19.0 # via # -r requirements/docs.txt # -r requirements/test.txt # importlib-metadata # importlib-resources -zope-interface==6.4.post1 +zope-interface==6.4.post2 # via # -r requirements/test.txt # cybersource-rest-client-python diff --git a/requirements/docs.txt b/requirements/docs.txt index 1acc36c0730..a0bba9e36d7 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -76,11 +76,11 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -typing-extensions==4.11.0 +typing-extensions==4.12.0 # via pydata-sphinx-theme urllib3==1.26.18 # via # -c requirements/constraints.txt # requests -zipp==3.18.2 +zipp==3.19.0 # via importlib-metadata diff --git a/requirements/e2e.txt b/requirements/e2e.txt index 7c6fb130fe4..115c342830d 100644 --- a/requirements/e2e.txt +++ b/requirements/e2e.txt @@ -64,7 +64,7 @@ importlib-metadata==7.1.0 # pytest-randomly iniconfig==2.0.0 # via pytest -newrelic==9.9.1 +newrelic==9.10.0 # via # -c requirements/base.txt # edx-django-utils @@ -176,7 +176,7 @@ tenacity==6.3.1 # via pytest-selenium toml==0.10.2 # via pytest -typing-extensions==4.11.0 +typing-extensions==4.12.0 # via # -c requirements/base.txt # asgiref @@ -186,7 +186,7 @@ urllib3==1.26.18 # -c requirements/constraints.txt # requests # selenium -zipp==3.18.2 +zipp==3.19.0 # via # -c requirements/base.txt # importlib-metadata diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt index 0ae0a48cd90..68847b8975d 100644 --- a/requirements/pip_tools.txt +++ b/requirements/pip_tools.txt @@ -24,7 +24,7 @@ tomli==2.0.1 # pip-tools wheel==0.43.0 # via pip-tools -zipp==3.18.2 +zipp==3.19.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/production.txt b/requirements/production.txt index 8ee56f70df8..5bc6a72f5f2 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -53,11 +53,11 @@ billiard==4.2.0 # via celery bleach==6.1.0 # via -r requirements/base.in -boto3==1.34.111 +boto3==1.34.115 # via # -r requirements/base.in # django-ses -botocore==1.34.111 +botocore==1.34.115 # via # boto3 # s3transfer @@ -107,7 +107,7 @@ coreapi==2.3.3 # via -r requirements/base.in coreschema==0.0.4 # via coreapi -coverage==7.5.1 +coverage==7.5.3 # via cybersource-rest-client-python crispy-bootstrap3==2024.1 # via -r requirements/base.in @@ -202,7 +202,7 @@ django-libsass==0.9 # via -r requirements/base.in django-model-utils==4.5.1 # via edx-rbac -django-oscar==3.2.4 +django-oscar==3.2 # via # -c requirements/constraints.txt # -r requirements/base.in @@ -293,7 +293,7 @@ extras==1.0.0 # via cybersource-rest-client-python factory-boy==3.2.1 # via django-oscar -faker==25.2.0 +faker==25.3.0 # via factory-boy fixtures==4.1.0 # via cybersource-rest-client-python @@ -415,7 +415,7 @@ needle==0.5.0 # -c requirements/constraints.txt # -r requirements/base.in # -r requirements/production.in -newrelic==9.9.1 +newrelic==9.10.0 # via # -r requirements/base.in # -r requirements/production.in @@ -464,7 +464,7 @@ platformdirs==4.2.2 # zeep premailer==2.9.2 # via -r requirements/base.in -prompt-toolkit==3.0.43 +prompt-toolkit==3.0.45 # via click-repl proto-plus==1.23.0 # via google-api-core @@ -686,7 +686,7 @@ stevedore==5.2.0 # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.7.0 +stripe==9.8.0 # via -r requirements/base.in testtools==2.7.1 # via @@ -702,7 +702,7 @@ traceback2==1.4.0 # via cybersource-rest-client-python typing==3.7.4.3 # via cybersource-rest-client-python -typing-extensions==4.11.0 +typing-extensions==4.12.0 # via # asgiref # astroid @@ -747,11 +747,11 @@ yarl==1.9.4 # via aiohttp zeep==4.2.1 # via -r requirements/base.in -zipp==3.18.2 +zipp==3.19.0 # via # importlib-metadata # importlib-resources -zope-interface==6.4.post1 +zope-interface==6.4.post2 # via # cybersource-rest-client-python # datetime diff --git a/requirements/test.txt b/requirements/test.txt index 007ac44deb7..01769d0fa6d 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -79,9 +79,9 @@ billiard==4.2.0 # celery bleach==6.1.0 # via -r requirements/base.txt -boto3==1.34.111 +boto3==1.34.115 # via -r requirements/base.txt -botocore==1.34.111 +botocore==1.34.115 # via # -r requirements/base.txt # boto3 @@ -161,7 +161,7 @@ coreschema==0.0.4 # via # -r requirements/base.txt # coreapi -coverage[toml]==7.5.1 +coverage[toml]==7.5.3 # via # -r requirements/base.txt # -r requirements/test.in @@ -290,7 +290,7 @@ django-model-utils==4.5.1 # via # -r requirements/base.txt # edx-rbac -django-oscar==3.2.4 +django-oscar==3.2 # via # -c requirements/constraints.txt # -r requirements/base.txt @@ -407,7 +407,7 @@ factory-boy==3.2.1 # -r requirements/base.txt # -r requirements/test.in # django-oscar -faker==25.2.0 +faker==25.3.0 # via # -r requirements/base.txt # factory-boy @@ -601,7 +601,7 @@ needle==0.5.0 # via # -c requirements/constraints.txt # -r requirements/base.txt -newrelic==9.9.1 +newrelic==9.10.0 # via # -r requirements/base.txt # -r requirements/e2e.txt @@ -681,7 +681,7 @@ polib==1.2.0 # via edx-i18n-tools premailer==2.9.2 # via -r requirements/base.txt -prompt-toolkit==3.0.43 +prompt-toolkit==3.0.45 # via # -r requirements/base.txt # click-repl @@ -1054,7 +1054,7 @@ stevedore==5.2.0 # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.7.0 +stripe==9.8.0 # via -r requirements/base.txt tenacity==6.3.1 # via @@ -1101,7 +1101,7 @@ typing==3.7.4.3 # via # -r requirements/base.txt # cybersource-rest-client-python -typing-extensions==4.11.0 +typing-extensions==4.12.0 # via # -r requirements/base.txt # -r requirements/e2e.txt @@ -1175,13 +1175,13 @@ yarl==1.9.4 # aiohttp zeep==4.2.1 # via -r requirements/base.txt -zipp==3.18.2 +zipp==3.19.0 # via # -r requirements/base.txt # -r requirements/e2e.txt # importlib-metadata # importlib-resources -zope-interface==6.4.post1 +zope-interface==6.4.post2 # via # -r requirements/base.txt # cybersource-rest-client-python From 146fe1322ebb936d68fce569302c18ecfe1936ba Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Fri, 31 May 2024 16:02:49 +0500 Subject: [PATCH 3/4] refactor: address comments --- ecommerce/credit/tests/test_views.py | 3 + pylintrc_backup | 294 --------------------------- requirements/base.in | 2 - requirements/base.txt | 81 +------- requirements/constraints.txt | 2 +- requirements/dev.in | 5 +- requirements/dev.txt | 18 +- requirements/e2e.txt | 1 - requirements/production.in | 2 - requirements/production.txt | 83 +------- requirements/test.in | 1 - requirements/test.txt | 57 ++---- 12 files changed, 35 insertions(+), 514 deletions(-) delete mode 100644 pylintrc_backup diff --git a/ecommerce/credit/tests/test_views.py b/ecommerce/credit/tests/test_views.py index f34e0a85dd5..80b8595acc3 100644 --- a/ecommerce/credit/tests/test_views.py +++ b/ecommerce/credit/tests/test_views.py @@ -131,6 +131,9 @@ def _assert_success_checkout_page(self, sku=None): response = self.client.get(self.path) self.assertEqual(response.status_code, 200) if sys.version_info > (3, 9): + # assertDictContainsSubset is depreciated in python version>3.9 + # context.response return ContextList object, belwo statements will convert it to dict + # assertLessEqual method is used instead of depreciated assertDictContainsSubset method context = {} for i, ctx in enumerate(response.context): if isinstance(ctx, dict): diff --git a/pylintrc_backup b/pylintrc_backup deleted file mode 100644 index 7206c5f1f05..00000000000 --- a/pylintrc_backup +++ /dev/null @@ -1,294 +0,0 @@ -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook='' - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS, migrations, settings, wsgi.py - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -[MESSAGES CONTROL] - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). -disable= -# Never going to use these -# I0011: Locally disabling W0232 -# W0141: Used builtin function 'map' -# W0142: Used * or ** magic -# R0921: Abstract class not referenced -# R0922: Abstract class is only referenced 1 times - I0011,W0141,W0142,R0921,R0922, - -# Django makes classes that trigger these -# W0232: Class has no __init__ method - W0232, - -# Might use these when the code is in better shape -# C0302: Too many lines in module -# R0201: Method could be a function -# R0901: Too many ancestors -# R0902: Too many instance attributes -# R0903: Too few public methods (1/2) -# R0904: Too many public methods -# R0911: Too many return statements -# R0912: Too many branches -# R0913: Too many arguments -# R0914: Too many local variables - C0302,R0201,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914, -# W0511: TODOs etc - W0511, -# E1103: maybe no member - E1103, -# C0111: missing docstring (handled by pep257) - C0111, - - duplicate-code, - -# New when we unpinned and jumped versions (pylint 2.4.4 -> 2.12.2) -# C0103: invalid-name -# C0201: consider-iterating-dictionary -# C0206: consider-using-dict-items -# C0209: consider-using-f-string -# R1725: super-with-arguments -# R1728: consider-using-generator -# R1729: use-a-generator -# R1734: use-list-literal -# W0237: arguments renamed -# W1310: format-string-without-interpolation -# W1406: redundant-u-string-prefix -# W1514: unspecified-encoding - - C0103,C0201,C0206,C0209,R1725,R1728,R1729,R1734,W0237,W1310,W1406,W1514 - -# We can decide if names are invalid on our own - invalid-name, - -# We use isort for import order, so we can ignore -# the pylint import errors, since they conflict at times. - wrong-import-order, - ungrouped-imports, - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html -output-format=text - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=no - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members= - REQUEST, - acl_users, - aq_parent, - objects, - DoesNotExist, - can_read, - can_write, - get_url, - size, - content, - status_code, -# For factory_boy factories - create - - -[BASIC] - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns)$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct method names -method-rgx=([a-z_][a-z0-9_]{2,60}|setUp|set[Uu]pClass|tearDown|tear[Dd]ownClass|assert[A-Z]\w*)$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__|test_.*|setUp|tearDown - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=120 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the beginning of the name of dummy variables -# (i.e. not used). -dummy-variables-rgx=_|dummy|unused|.*_unused - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branchs=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/requirements/base.in b/requirements/base.in index 16c4826fcf9..590ea2ff4cd 100755 --- a/requirements/base.in +++ b/requirements/base.in @@ -31,7 +31,6 @@ edx-django-utils edx-drf-extensions>=8.13.0 # 8.13 fixes forgiven JWTs for ecommerce edx-django-sites-extensions edx-ecommerce-worker -edx-lint edx-opaque-keys edx-rbac edx-rest-api-client @@ -47,7 +46,6 @@ markdown==3.4.3 mysqlclient newrelic ndg-httpsclient -needle openedx-atlas path.py==7.2 paypalrestsdk diff --git a/requirements/base.txt b/requirements/base.txt index 4f1435dd396..9115b7580fa 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -20,11 +20,6 @@ asgiref==3.8.1 # django-cors-headers asn1crypto==1.5.1 # via cybersource-rest-client-python -astroid==3.2.2 - # via - # -c requirements/constraints.txt - # pylint - # pylint-celery async-timeout==4.0.3 # via # aiohttp @@ -53,9 +48,9 @@ billiard==4.2.0 # via celery bleach==6.1.0 # via -r requirements/base.in -boto3==1.34.115 +boto3==1.34.116 # via -r requirements/base.in -botocore==1.34.115 +botocore==1.34.116 # via # boto3 # s3transfer @@ -83,22 +78,15 @@ click==8.1.7 # via # celery # click-didyoumean - # click-log # click-plugins # click-repl - # code-annotations # edx-django-utils - # edx-lint click-didyoumean==0.3.1 # via celery -click-log==0.4.0 - # via edx-lint click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery -code-annotations==1.8.0 - # via edx-lint configparser==7.0.0 # via cybersource-rest-client-python coreapi==2.3.3 @@ -133,8 +121,6 @@ defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core -dill==0.3.8 - # via pylint django==3.2.25 # via # -c requirements/common_constraints.txt @@ -267,10 +253,6 @@ edx-drf-extensions==10.3.0 # edx-rbac edx-ecommerce-worker==3.3.4 # via -r requirements/base.in -edx-lint==5.3.6 - # via - # -c requirements/constraints.txt - # -r requirements/base.in edx-opaque-keys==2.9.0 # via # -r requirements/base.in @@ -342,14 +324,10 @@ iso8601==2.1.0 # via python-subunit isodate==0.6.1 # via zeep -isort==5.13.2 - # via pylint itypes==1.2.0 # via coreapi jinja2==3.1.4 - # via - # code-annotations - # coreschema + # via coreschema jmespath==1.0.1 # via # boto3 @@ -386,8 +364,6 @@ markdown==3.4.3 # via -r requirements/base.in markupsafe==2.1.5 # via jinja2 -mccabe==0.7.0 - # via pylint monotonic==1.6 # via analytics-python multidict==6.0.5 @@ -402,18 +378,12 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/base.in -needle==0.5.0 - # via - # -c requirements/constraints.txt - # -r requirements/base.in newrelic==9.10.0 # via # -r requirements/base.in # edx-django-utils nose==1.3.7 - # via - # cybersource-rest-client-python - # needle + # via cybersource-rest-client-python oauth2client==4.1.3 # via inapppy oauthlib==3.2.2 @@ -441,15 +411,11 @@ pbr==6.0.0 phonenumbers==8.13.37 # via django-oscar pillow==10.3.0 - # via - # django-oscar - # needle + # via django-oscar pkgutil-resolve-name==1.3.10 # via jsonschema platformdirs==4.2.2 - # via - # pylint - # zeep + # via zeep premailer==2.9.2 # via -r requirements/base.in prompt-toolkit==3.0.45 @@ -499,21 +465,6 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-rest-api-client # social-auth-core -pylint==3.2.2 - # via - # -c requirements/constraints.txt - # edx-lint - # pylint-celery - # pylint-django - # pylint-plugin-utils -pylint-celery==0.3 - # via edx-lint -pylint-django==2.5.5 - # via edx-lint -pylint-plugin-utils==0.8.2 - # via - # pylint-celery - # pylint-django pymongo==4.4.0 # via edx-opaque-keys pynacl==1.5.0 @@ -540,8 +491,6 @@ python-dateutil==2.9.0.post0 # faker python-mimeparse==1.6.0 # via cybersource-rest-client-python -python-slugify==8.0.4 - # via code-annotations python-subunit==1.4.4 # via cybersource-rest-client-python python-toolbox==1.0.11 @@ -563,7 +512,6 @@ pytz==2024.1 # zeep pyyaml==6.0.1 # via - # code-annotations # cybersource-rest-client-python # drf-yasg # edx-django-release-util @@ -620,10 +568,6 @@ rules==3.4 # via -r requirements/base.in s3transfer==0.10.1 # via boto3 -selenium==3.141.0 - # via - # -c requirements/constraints.txt - # needle semantic-version==2.10.0 # via edx-drf-extensions shellescape==3.8.1 @@ -640,7 +584,6 @@ six==1.16.0 # edx-auth-backends # edx-django-release-util # edx-ecommerce-worker - # edx-lint # edx-rbac # isodate # oauth2client @@ -664,21 +607,14 @@ sqlparse==0.5.0 # via django stevedore==5.2.0 # via - # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.8.0 +stripe==9.9.0 # via -r requirements/base.in testtools==2.7.1 # via # cybersource-rest-client-python # python-subunit -text-unidecode==1.3 - # via python-slugify -tomli==2.0.1 - # via pylint -tomlkit==0.12.5 - # via pylint traceback2==1.4.0 # via cybersource-rest-client-python typing==3.7.4.3 @@ -686,10 +622,8 @@ typing==3.7.4.3 typing-extensions==4.12.0 # via # asgiref - # astroid # edx-opaque-keys # kombu - # pylint # stripe tzdata==2024.1 # via @@ -708,7 +642,6 @@ urllib3==1.26.18 # botocore # cybersource-rest-client-python # requests - # selenium vine==5.1.0 # via # amqp diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 69ef8600885..ce68ff7c013 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -44,11 +44,11 @@ social-auth-app-django==5.2.0 selenium<=4 pytest-selenium==3.0.0 pytest-variables==1.9.0 -needle==0.5.0 requests==2.32.2 pylint==3.2.2 edx-lint==5.3.6 +# other versions of astroid has conflicts with pylint astroid==3.2.2 # backports-zoneinfo comes by-default in newer versions of python diff --git a/requirements/dev.in b/requirements/dev.in index cc864c661af..6a81372cbe7 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -2,7 +2,6 @@ -r docs.txt django-debug-toolbar -needle # i18n # newer version of transifex-client doesn't work with python3.12.2 transifex-client==0.12.5 @@ -11,6 +10,4 @@ transifex-client==0.12.5 ptvsd # For devserver code reloading -pywatchman -astroid==3.2.2 -edx-lint \ No newline at end of file +pywatchman \ No newline at end of file diff --git a/requirements/dev.txt b/requirements/dev.txt index 0f861f45694..0dc463448f9 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -39,7 +39,6 @@ asn1crypto==1.5.1 # cybersource-rest-client-python astroid==3.2.2 # via - # -r requirements/dev.in # -r requirements/test.txt # pylint # pylint-celery @@ -90,9 +89,9 @@ billiard==4.2.0 # celery bleach==6.1.0 # via -r requirements/test.txt -boto3==1.34.115 +boto3==1.34.116 # via -r requirements/test.txt -botocore==1.34.115 +botocore==1.34.116 # via # -r requirements/test.txt # boto3 @@ -384,9 +383,7 @@ edx-ecommerce-worker==3.3.4 edx-i18n-tools==1.6.0 # via -r requirements/test.txt edx-lint==5.3.6 - # via - # -r requirements/dev.in - # -r requirements/test.txt + # via -r requirements/test.txt edx-opaque-keys==2.9.0 # via # -r requirements/test.txt @@ -602,10 +599,6 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/test.txt -needle==0.5.0 - # via - # -r requirements/dev.in - # -r requirements/test.txt newrelic==9.10.0 # via # -r requirements/test.txt @@ -614,7 +607,6 @@ nose==1.3.7 # via # -r requirements/test.txt # cybersource-rest-client-python - # needle oauth2client==4.1.3 # via # -r requirements/test.txt @@ -663,7 +655,6 @@ pillow==10.3.0 # via # -r requirements/test.txt # django-oscar - # needle pkgutil-resolve-name==1.3.10 # via # -r requirements/test.txt @@ -990,7 +981,6 @@ s3transfer==0.10.1 selenium==3.141.0 # via # -r requirements/test.txt - # needle # pytest-selenium semantic-version==2.10.0 # via @@ -1090,7 +1080,7 @@ stevedore==5.2.0 # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.8.0 +stripe==9.9.0 # via -r requirements/test.txt tenacity==6.3.1 # via diff --git a/requirements/e2e.txt b/requirements/e2e.txt index 115c342830d..954612d6bde 100644 --- a/requirements/e2e.txt +++ b/requirements/e2e.txt @@ -151,7 +151,6 @@ requests==2.32.2 # slumber selenium==3.141.0 # via - # -c requirements/base.txt # -c requirements/constraints.txt # -r requirements/e2e.in # pytest-selenium diff --git a/requirements/production.in b/requirements/production.in index 2fa07274608..c485b80a968 100644 --- a/requirements/production.in +++ b/requirements/production.in @@ -3,9 +3,7 @@ -r base.in django-ses -edx-lint gunicorn==19.7.1 -needle newrelic python-memcached==1.59 PyYAML diff --git a/requirements/production.txt b/requirements/production.txt index 5bc6a72f5f2..e2893e26721 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -20,11 +20,6 @@ asgiref==3.8.1 # django-cors-headers asn1crypto==1.5.1 # via cybersource-rest-client-python -astroid==3.2.2 - # via - # -c requirements/constraints.txt - # pylint - # pylint-celery async-timeout==4.0.3 # via # aiohttp @@ -53,11 +48,11 @@ billiard==4.2.0 # via celery bleach==6.1.0 # via -r requirements/base.in -boto3==1.34.115 +boto3==1.34.116 # via # -r requirements/base.in # django-ses -botocore==1.34.115 +botocore==1.34.116 # via # boto3 # s3transfer @@ -85,22 +80,15 @@ click==8.1.7 # via # celery # click-didyoumean - # click-log # click-plugins # click-repl - # code-annotations # edx-django-utils - # edx-lint click-didyoumean==0.3.1 # via celery -click-log==0.4.0 - # via edx-lint click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery -code-annotations==1.8.0 - # via edx-lint configparser==7.0.0 # via cybersource-rest-client-python coreapi==2.3.3 @@ -135,8 +123,6 @@ defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core -dill==0.3.8 - # via pylint django==3.2.25 # via # -c requirements/common_constraints.txt @@ -272,11 +258,6 @@ edx-drf-extensions==10.3.0 # edx-rbac edx-ecommerce-worker==3.3.4 # via -r requirements/base.in -edx-lint==5.3.6 - # via - # -c requirements/constraints.txt - # -r requirements/base.in - # -r requirements/production.in edx-opaque-keys==2.9.0 # via # -r requirements/base.in @@ -350,14 +331,10 @@ iso8601==2.1.0 # via python-subunit isodate==0.6.1 # via zeep -isort==5.13.2 - # via pylint itypes==1.2.0 # via coreapi jinja2==3.1.4 - # via - # code-annotations - # coreschema + # via coreschema jmespath==1.0.1 # via # boto3 @@ -394,8 +371,6 @@ markdown==3.4.3 # via -r requirements/base.in markupsafe==2.1.5 # via jinja2 -mccabe==0.7.0 - # via pylint monotonic==1.6 # via analytics-python multidict==6.0.5 @@ -410,11 +385,6 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/base.in -needle==0.5.0 - # via - # -c requirements/constraints.txt - # -r requirements/base.in - # -r requirements/production.in newrelic==9.10.0 # via # -r requirements/base.in @@ -423,9 +393,7 @@ newrelic==9.10.0 nodeenv==1.1.1 # via -r requirements/production.in nose==1.3.7 - # via - # cybersource-rest-client-python - # needle + # via cybersource-rest-client-python oauth2client==4.1.3 # via inapppy oauthlib==3.2.2 @@ -453,15 +421,11 @@ pbr==6.0.0 phonenumbers==8.13.37 # via django-oscar pillow==10.3.0 - # via - # django-oscar - # needle + # via django-oscar pkgutil-resolve-name==1.3.10 # via jsonschema platformdirs==4.2.2 - # via - # pylint - # zeep + # via zeep premailer==2.9.2 # via -r requirements/base.in prompt-toolkit==3.0.45 @@ -511,21 +475,6 @@ pyjwt[crypto]==2.8.0 # edx-drf-extensions # edx-rest-api-client # social-auth-core -pylint==3.2.2 - # via - # -c requirements/constraints.txt - # edx-lint - # pylint-celery - # pylint-django - # pylint-plugin-utils -pylint-celery==0.3 - # via edx-lint -pylint-django==2.5.5 - # via edx-lint -pylint-plugin-utils==0.8.2 - # via - # pylint-celery - # pylint-django pymongo==4.4.0 # via edx-opaque-keys pynacl==1.5.0 @@ -554,8 +503,6 @@ python-memcached==1.59 # via -r requirements/production.in python-mimeparse==1.6.0 # via cybersource-rest-client-python -python-slugify==8.0.4 - # via code-annotations python-subunit==1.4.4 # via cybersource-rest-client-python python-toolbox==1.0.11 @@ -579,7 +526,6 @@ pytz==2024.1 pyyaml==6.0.1 # via # -r requirements/production.in - # code-annotations # cybersource-rest-client-python # drf-yasg # edx-django-release-util @@ -638,10 +584,6 @@ rules==3.4 # via -r requirements/base.in s3transfer==0.10.1 # via boto3 -selenium==3.141.0 - # via - # -c requirements/constraints.txt - # needle semantic-version==2.10.0 # via edx-drf-extensions shellescape==3.8.1 @@ -658,7 +600,6 @@ six==1.16.0 # edx-auth-backends # edx-django-release-util # edx-ecommerce-worker - # edx-lint # edx-rbac # isodate # oauth2client @@ -683,21 +624,14 @@ sqlparse==0.5.0 # via django stevedore==5.2.0 # via - # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.8.0 +stripe==9.9.0 # via -r requirements/base.in testtools==2.7.1 # via # cybersource-rest-client-python # python-subunit -text-unidecode==1.3 - # via python-slugify -tomli==2.0.1 - # via pylint -tomlkit==0.12.5 - # via pylint traceback2==1.4.0 # via cybersource-rest-client-python typing==3.7.4.3 @@ -705,10 +639,8 @@ typing==3.7.4.3 typing-extensions==4.12.0 # via # asgiref - # astroid # edx-opaque-keys # kombu - # pylint # stripe tzdata==2024.1 # via @@ -727,7 +659,6 @@ urllib3==1.26.18 # botocore # cybersource-rest-client-python # requests - # selenium vine==5.1.0 # via # amqp diff --git a/requirements/test.in b/requirements/test.in index 6b7a81f6a2d..2eb8017350c 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -3,7 +3,6 @@ -r e2e.txt # required for quality -r tox.txt -astroid==3.2.2 coverage ddt diff-cover diff --git a/requirements/test.txt b/requirements/test.txt index 01769d0fa6d..3ca96f23599 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -33,8 +33,6 @@ asn1crypto==1.5.1 astroid==3.2.2 # via # -c requirements/constraints.txt - # -r requirements/base.txt - # -r requirements/test.in # pylint # pylint-celery async-timeout==4.0.3 @@ -79,9 +77,9 @@ billiard==4.2.0 # celery bleach==6.1.0 # via -r requirements/base.txt -boto3==1.34.115 +boto3==1.34.116 # via -r requirements/base.txt -botocore==1.34.115 +botocore==1.34.116 # via # -r requirements/base.txt # boto3 @@ -136,9 +134,7 @@ click-didyoumean==0.3.1 # -r requirements/base.txt # celery click-log==0.4.0 - # via - # -r requirements/base.txt - # edx-lint + # via edx-lint click-plugins==1.1.1 # via # -r requirements/base.txt @@ -148,9 +144,7 @@ click-repl==0.3.0 # -r requirements/base.txt # celery code-annotations==1.8.0 - # via - # -r requirements/base.txt - # edx-lint + # via edx-lint configparser==7.0.0 # via # -r requirements/base.txt @@ -208,9 +202,7 @@ defusedxml==0.8.0rc2 diff-cover==9.0.0 # via -r requirements/test.in dill==0.3.8 - # via - # -r requirements/base.txt - # pylint + # via pylint distlib==0.3.8 # via # -r requirements/tox.txt @@ -381,7 +373,6 @@ edx-i18n-tools==1.6.0 edx-lint==5.3.6 # via # -c requirements/constraints.txt - # -r requirements/base.txt # -r requirements/test.in edx-opaque-keys==2.9.0 # via @@ -508,7 +499,6 @@ isodate==0.6.1 # zeep isort==5.13.2 # via - # -r requirements/base.txt # -r requirements/test.in # pylint itypes==1.2.0 @@ -574,9 +564,7 @@ markupsafe==2.1.5 # -r requirements/base.txt # jinja2 mccabe==0.7.0 - # via - # -r requirements/base.txt - # pylint + # via pylint mock==5.1.0 # via -r requirements/test.in monotonic==1.6 @@ -597,10 +585,6 @@ naked==0.1.32 # cybersource-rest-client-python ndg-httpsclient==0.5.1 # via -r requirements/base.txt -needle==0.5.0 - # via - # -c requirements/constraints.txt - # -r requirements/base.txt newrelic==9.10.0 # via # -r requirements/base.txt @@ -610,7 +594,6 @@ nose==1.3.7 # via # -r requirements/base.txt # cybersource-rest-client-python - # needle oauth2client==4.1.3 # via # -r requirements/base.txt @@ -657,7 +640,6 @@ pillow==10.3.0 # via # -r requirements/base.txt # django-oscar - # needle pkgutil-resolve-name==1.3.10 # via # -r requirements/base.txt @@ -766,23 +748,17 @@ pyjwt[crypto]==2.8.0 pylint==3.2.2 # via # -c requirements/constraints.txt - # -r requirements/base.txt # -r requirements/test.in # edx-lint # pylint-celery # pylint-django # pylint-plugin-utils pylint-celery==0.3 - # via - # -r requirements/base.txt - # edx-lint + # via edx-lint pylint-django==2.5.5 - # via - # -r requirements/base.txt - # edx-lint + # via edx-lint pylint-plugin-utils==0.8.2 # via - # -r requirements/base.txt # pylint-celery # pylint-django pymongo==4.4.0 @@ -870,9 +846,7 @@ python-mimeparse==1.6.0 # -r requirements/base.txt # cybersource-rest-client-python python-slugify==8.0.4 - # via - # -r requirements/base.txt - # code-annotations + # via code-annotations python-subunit==1.4.4 # via # -r requirements/base.txt @@ -985,10 +959,8 @@ s3transfer==0.10.1 selenium==3.141.0 # via # -c requirements/constraints.txt - # -r requirements/base.txt # -r requirements/e2e.txt # -r requirements/test.in - # needle # pytest-selenium semantic-version==2.10.0 # via @@ -1054,7 +1026,7 @@ stevedore==5.2.0 # code-annotations # edx-django-utils # edx-opaque-keys -stripe==9.8.0 +stripe==9.9.0 # via -r requirements/base.txt tenacity==6.3.1 # via @@ -1068,9 +1040,7 @@ testtools==2.7.1 # cybersource-rest-client-python # python-subunit text-unidecode==1.3 - # via - # -r requirements/base.txt - # python-slugify + # via python-slugify toml==0.10.2 # via # -r requirements/e2e.txt @@ -1079,13 +1049,10 @@ toml==0.10.2 # tox tomli==2.0.1 # via - # -r requirements/base.txt # coverage # pylint tomlkit==0.12.5 - # via - # -r requirements/base.txt - # pylint + # via pylint tox==3.14.6 # via # -c requirements/constraints.txt From 9360ac074b75a572f9addae47e062c171875ebbe Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Fri, 14 Jun 2024 14:13:55 +0500 Subject: [PATCH 4/4] refactor: address comments --- ecommerce/core/tests/test_models.py | 6 +--- ecommerce/credit/tests/test_views.py | 29 ++++++++--------- ecommerce/enterprise/tests/test_utils.py | 6 +--- .../extensions/checkout/tests/test_views.py | 31 ++++--------------- .../fulfillment/tests/test_modules.py | 6 +--- .../tests/processors/test_cybersource.py | 6 +--- .../extensions/voucher/tests/test_utils.py | 6 +--- 7 files changed, 24 insertions(+), 66 deletions(-) diff --git a/ecommerce/core/tests/test_models.py b/ecommerce/core/tests/test_models.py index b4fcf286fcc..423b1be32eb 100644 --- a/ecommerce/core/tests/test_models.py +++ b/ecommerce/core/tests/test_models.py @@ -1,7 +1,6 @@ import json -import sys import ddt import mock @@ -178,10 +177,7 @@ def test_user_details_uses_jwt(self): # Verify the headers passed to the API were correct. expected = {'Authorization': 'JWT {}'.format(token), } - if sys.version_info > (3, 9): - self.assertLessEqual(expected.items(), last_request.headers.items()) - else: - self.assertDictContainsSubset(expected, last_request.headers) + self.assertLessEqual(expected.items(), last_request.headers.items()) def test_no_user_details(self): """ Verify False is returned when there is a connection error. """ diff --git a/ecommerce/credit/tests/test_views.py b/ecommerce/credit/tests/test_views.py index 80b8595acc3..d5b93272836 100644 --- a/ecommerce/credit/tests/test_views.py +++ b/ecommerce/credit/tests/test_views.py @@ -2,7 +2,6 @@ Tests for the checkout page. """ -import sys from datetime import timedelta import ddt @@ -130,21 +129,19 @@ def _assert_success_checkout_page(self, sku=None): response = self.client.get(self.path) self.assertEqual(response.status_code, 200) - if sys.version_info > (3, 9): - # assertDictContainsSubset is depreciated in python version>3.9 - # context.response return ContextList object, belwo statements will convert it to dict - # assertLessEqual method is used instead of depreciated assertDictContainsSubset method - context = {} - for i, ctx in enumerate(response.context): - if isinstance(ctx, dict): - context.update(ctx) - elif hasattr(ctx, '__iter__') and not isinstance(ctx, str): - for item in ctx: - if isinstance(item, dict): - context.update(item) - self.assertLessEqual({'course': self.course}.items(), context.items()) - else: - self.assertDictContainsSubset({'course': self.course}, response.context) + + # assertDictContainsSubset is deprecated in Python version > 3.9 + # response.context returns a ContextList object; the below statements will convert it to a dict + # assertLessEqual method is used instead of the deprecated assertDictContainsSubset method + context = {} + for i, ctx in enumerate(response.context): + if isinstance(ctx, dict): + context.update(ctx) + elif hasattr(ctx, '__iter__') and not isinstance(ctx, str): + for item in ctx: + if isinstance(item, dict): + context.update(item) + self.assertLessEqual({'course': self.course}.items(), context.items()) self.assertContains( response, diff --git a/ecommerce/enterprise/tests/test_utils.py b/ecommerce/enterprise/tests/test_utils.py index ccae48c4b30..bd83dcac305 100644 --- a/ecommerce/enterprise/tests/test_utils.py +++ b/ecommerce/enterprise/tests/test_utils.py @@ -1,6 +1,5 @@ -import sys import uuid import ddt @@ -123,10 +122,7 @@ def test_post_enterprise_customer_user(self, mock_helpers, expected_return): self.learner.username ) - if sys.version_info > (3, 9): - self.assertLessEqual(expected_return.items(), response.items()) - else: - self.assertDictContainsSubset(expected_return, response) + self.assertLessEqual(expected_return.items(), response.items()) @responses.activate def test_ecu_needs_consent(self): diff --git a/ecommerce/extensions/checkout/tests/test_views.py b/ecommerce/extensions/checkout/tests/test_views.py index 311c9dbfa9a..8adfa8f9039 100644 --- a/ecommerce/extensions/checkout/tests/test_views.py +++ b/ecommerce/extensions/checkout/tests/test_views.py @@ -1,6 +1,5 @@ -import sys from decimal import Decimal from urllib import parse @@ -339,10 +338,7 @@ def test_get_receipt_for_existing_order(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - if sys.version_info > (3, 9): - self.assertEqual(response.context_data, response.context_data | context_data) - else: - self.assertDictContainsSubset(context_data, response.context_data) + self.assertLessEqual(context_data.items(), response.context_data.items()) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -375,10 +371,7 @@ def test_get_receipt_for_existing_entitlement_order(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - if sys.version_info > (3, 9): - self.assertEqual(response.context_data, response.context_data | context_data) - else: - self.assertDictContainsSubset(context_data, response.context_data) + self.assertLessEqual(context_data.items(), response.context_data.items()) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -394,10 +387,7 @@ def test_get_receipt_for_existing_order_as_staff_user(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - if sys.version_info > (3, 9): - self.assertEqual(response.context_data, response.context_data | context_data) - else: - self.assertDictContainsSubset(context_data, response.context_data) + self.assertLessEqual(context_data.items(), response.context_data.items()) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -410,10 +400,7 @@ def test_get_receipt_for_existing_order_user_not_owner(self, mock_learner_data): context_data = {'order_history_url': self.site.siteconfiguration.build_lms_url('account/settings')} self.assertEqual(response.status_code, 404) - if sys.version_info > (3, 9): - self.assertEqual(response.context_data, response.context_data | context_data) - else: - self.assertDictContainsSubset(context_data, response.context_data) + self.assertLessEqual(context_data.items(), response.context_data.items()) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -469,10 +456,7 @@ def test_dashboard_link_for_course_purchase(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - if sys.version_info > (3, 9): - self.assertEqual(response.context_data, response.context_data | context_data) - else: - self.assertDictContainsSubset(context_data, response.context_data) + self.assertLessEqual(context_data.items(), response.context_data.items()) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate @@ -498,10 +482,7 @@ def test_dashboard_link_for_bundle_purchase(self, mock_learner_data): } self.assertEqual(response.status_code, 200) - if sys.version_info > (3, 9): - self.assertEqual(response.context_data, response.context_data | context_data) - else: - self.assertDictContainsSubset(context_data, response.context_data) + self.assertLessEqual(context_data.items(), response.context_data.items()) @patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data') @responses.activate diff --git a/ecommerce/extensions/fulfillment/tests/test_modules.py b/ecommerce/extensions/fulfillment/tests/test_modules.py index 880dcd077f3..ff8a5ff4e63 100644 --- a/ecommerce/extensions/fulfillment/tests/test_modules.py +++ b/ecommerce/extensions/fulfillment/tests/test_modules.py @@ -3,7 +3,6 @@ import datetime import json -import sys import uuid from decimal import Decimal from urllib.parse import urlencode @@ -213,10 +212,7 @@ def test_enrollment_module_fulfill(self): 'X-Forwarded-For': self.user.tracking_context['lms_ip'], } - if sys.version_info > (3, 9): - self.assertLessEqual(expected_headers.items(), actual_headers.items()) - else: - self.assertDictContainsSubset(expected_headers, actual_headers) + self.assertLessEqual(expected_headers.items(), actual_headers.items()) self.assertEqual(expected_body, actual_body) @responses.activate diff --git a/ecommerce/extensions/payment/tests/processors/test_cybersource.py b/ecommerce/extensions/payment/tests/processors/test_cybersource.py index fbdac1c3d9f..aa59b4c3680 100644 --- a/ecommerce/extensions/payment/tests/processors/test_cybersource.py +++ b/ecommerce/extensions/payment/tests/processors/test_cybersource.py @@ -3,7 +3,6 @@ import json -import sys from decimal import Decimal from unittest import SkipTest @@ -50,10 +49,7 @@ def assert_processor_response_recorded(self, processor_name, transaction_id, res expected = { 'requestID': transaction_id, } - if sys.version_info > (3, 9): - self.assertLessEqual(expected.items(), ppr.response.items()) - else: - self.assertDictContainsSubset(expected, ppr.response) + self.assertLessEqual(expected.items(), ppr.response.items()) self.assertEqual(ppr.basket, basket) return ppr.id diff --git a/ecommerce/extensions/voucher/tests/test_utils.py b/ecommerce/extensions/voucher/tests/test_utils.py index e59dfa87339..f8709e4d3b1 100644 --- a/ecommerce/extensions/voucher/tests/test_utils.py +++ b/ecommerce/extensions/voucher/tests/test_utils.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- -import sys import uuid import ddt @@ -524,10 +523,7 @@ def test_generate_coupon_report_with_deleted_product(self): __, rows = generate_coupon_report([query_coupon.attr.coupon_vouchers]) self.assert_report_first_row(rows[0], query_coupon, first_voucher) - if sys.version_info > (3, 9): - self.assertLessEqual({'Redeemed For Course ID': 'Unknown'}.items(), rows[2].items()) - else: - self.assertDictContainsSubset({'Redeemed For Course ID': 'Unknown'}, rows[2]) + self.assertLessEqual({'Redeemed For Course ID': 'Unknown'}.items(), rows[2].items()) def test_report_for_inactive_coupons(self): """ Verify the coupon report show correct status for inactive coupons. """