From ffa18228290833ca11a6b3f04eee899595cc2a5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:06:20 +0000 Subject: [PATCH 1/2] Bump pylint from 3.1.0 to 3.2.3 Bumps [pylint](https://github.com/pylint-dev/pylint) from 3.1.0 to 3.2.3. - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/v3.1.0...v3.2.3) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements/lint.txt | 338 +++++++++++++++++++++--------------------- 1 file changed, 169 insertions(+), 169 deletions(-) diff --git a/requirements/lint.txt b/requirements/lint.txt index 5d9600c3..e0bb8cf0 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -6,62 +6,62 @@ # alembic==1.13.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt amqp==5.2.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # kombu -astroid==3.1.0 +astroid==3.2.2 # via pylint attrs==23.2.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # jsonschema # referencing beautifulsoup4==4.12.2 # via - # -r tests.txt + # -r requirements/tests.txt # webtest billiard==4.2.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery build==1.0.3 # via - # -r tests.txt + # -r requirements/tests.txt # pip-tools cachetools==5.3.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # google-auth celery==5.4.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt certifi==2023.11.17 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # requests # sentry-sdk charset-normalizer==3.3.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # requests checkmatelib==1.0.15 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt click==8.1.7 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery # click-didyoumean # click-plugins @@ -69,144 +69,144 @@ click==8.1.7 # pip-tools click-didyoumean==0.3.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery click-plugins==1.1.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery click-repl==0.3.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery coverage==7.5.3 - # via -r tests.txt + # via -r requirements/tests.txt dill==0.3.7 # via pylint factory-boy==3.3.0 - # via -r tests.txt + # via -r requirements/tests.txt faker==22.0.0 # via - # -r tests.txt + # -r requirements/tests.txt # factory-boy google-auth==2.26.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # google-auth-oauthlib google-auth-oauthlib==1.2.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid-googleauth greenlet==3.0.3 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # sqlalchemy gunicorn==22.0.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt h-matchers==1.2.15 - # via -r tests.txt + # via -r requirements/tests.txt h-pyramid-sentry==1.2.4 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt h-testkit==1.0.1 - # via -r tests.txt + # via -r requirements/tests.txt httpretty==1.1.4 - # via -r tests.txt + # via -r requirements/tests.txt hupper==1.12 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid idna==3.7 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # requests importlib-metadata==7.0.1 # via - # -r tests.txt + # -r requirements/tests.txt # pip-sync-faster importlib-resources==6.4.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # checkmatelib iniconfig==2.0.0 # via - # -r tests.txt + # -r requirements/tests.txt # pytest isort==5.13.2 # via pylint jinja2==3.1.4 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid-jinja2 jsonschema==4.20.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # checkmatelib jsonschema-specifications==2023.12.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # jsonschema kombu==5.3.4 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery mako==1.3.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # alembic markupsafe==2.1.3 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # jinja2 # mako # pyramid-jinja2 marshmallow==3.20.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # marshmallow-jsonapi marshmallow-jsonapi==0.24.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt mccabe==0.7.0 # via pylint netaddr==0.10.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # checkmatelib newrelic==9.10.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt oauthlib==3.2.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # requests-oauthlib packaging==23.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # build # gunicorn # marshmallow @@ -214,73 +214,73 @@ packaging==23.2 # zope-sqlalchemy pastedeploy==3.1.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # plaster-pastedeploy pip-sync-faster==0.0.3 # via - # -r lint.in - # -r tests.txt + # -r requirements/lint.in + # -r requirements/tests.txt pip-tools==7.4.1 # via - # -r lint.in - # -r tests.txt + # -r requirements/lint.in + # -r requirements/tests.txt # pip-sync-faster plaster==1.1.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # plaster-pastedeploy # pyramid plaster-pastedeploy==1.0.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid platformdirs==4.1.0 # via pylint pluggy==1.5.0 # via - # -r tests.txt + # -r requirements/tests.txt # pytest prompt-toolkit==3.0.43 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # click-repl psycopg2==2.9.9 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt pyasn1==0.5.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyasn1-modules # rsa pyasn1-modules==0.3.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # google-auth pydocstyle==6.3.0 - # via -r lint.in + # via -r requirements/lint.in pyjwt==2.8.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid-googleauth -pylint==3.1.0 - # via -r lint.in +pylint==3.2.3 + # via -r requirements/lint.in pyproject-hooks==1.0.0 # via - # -r tests.txt + # -r requirements/tests.txt # build # pip-tools pyramid==2.0.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # h-pyramid-sentry # pyramid-exclog # pyramid-googleauth @@ -290,168 +290,168 @@ pyramid==2.0.2 # pyramid-tm pyramid-exclog==1.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt pyramid-googleauth==1.0.5 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt pyramid-jinja2==2.10.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt pyramid-sanity==1.0.3 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt pyramid-services==2.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt pyramid-tm==2.5 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt pytest==8.2.1 - # via -r tests.txt + # via -r requirements/tests.txt python-dateutil==2.8.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery # faker referencing==0.32.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # jsonschema # jsonschema-specifications requests==2.32.3 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # checkmatelib # requests-oauthlib requests-oauthlib==1.3.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # google-auth-oauthlib rpds-py==0.16.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # jsonschema # referencing rsa==4.9 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # google-auth sentry-sdk==2.3.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # h-pyramid-sentry six==1.16.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # python-dateutil snowballstemmer==2.2.0 # via pydocstyle soupsieve==2.5 # via - # -r tests.txt + # -r requirements/tests.txt # beautifulsoup4 sqlalchemy==2.0.30 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # alembic # zope-sqlalchemy tomlkit==0.12.3 # via pylint transaction==4.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid-tm # zope-sqlalchemy translationstring==1.4 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid typing-extensions==4.9.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # alembic # sqlalchemy tzdata==2023.4 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # celery urllib3==2.2.2 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # requests # sentry-sdk venusian==3.1.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid vine==5.1.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # amqp # celery # kombu waitress==2.1.2 # via - # -r tests.txt + # -r requirements/tests.txt # webtest wcwidth==0.2.13 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # prompt-toolkit webob==1.8.7 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid # webtest webtest==3.0.0 - # via -r tests.txt + # via -r requirements/tests.txt wheel==0.42.0 # via - # -r tests.txt + # -r requirements/tests.txt # pip-tools wired==0.3 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid-services zipp==3.17.0 # via - # -r tests.txt + # -r requirements/tests.txt # importlib-metadata zope-deprecation==5.0 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid # pyramid-jinja2 zope-interface==6.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pyramid # pyramid-services # transaction @@ -459,18 +459,18 @@ zope-interface==6.1 # zope-sqlalchemy zope-sqlalchemy==3.1 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # The following packages are considered to be unsafe in a requirements file: pip==23.3.2 # via - # -r tests.txt + # -r requirements/tests.txt # pip-tools setuptools==69.0.3 # via - # -r requirements.txt - # -r tests.txt + # -r requirements/requirements.txt + # -r requirements/tests.txt # pip-tools # pyramid # zope-deprecation From a88f3b7e3ce953ff638e16708be0015b9c1a2ab3 Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Tue, 25 Jun 2024 09:32:05 +0200 Subject: [PATCH 2/2] Fixes after pylint upgrade --- bin/update_dev_data.py | 6 +++--- checkmate/scripts/init_db.py | 1 + tests/unit/checkmate/checker/pipeline/file_test.py | 8 ++++---- tests/unit/checkmate/checker/url/allow_rules_test.py | 2 +- tests/unit/checkmate/checker/url/custom_rules_test.py | 5 +++-- tests/unit/checkmate/checker/url/url_haus_test.py | 4 ++-- tests/unit/checkmate/models/db/mixins_test.py | 8 +++++--- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bin/update_dev_data.py b/bin/update_dev_data.py index 7e18980e..2ef95f3e 100644 --- a/bin/update_dev_data.py +++ b/bin/update_dev_data.py @@ -35,7 +35,7 @@ def update_remote_dev_data(): ) -def update_dev_data(): +def update_dev_data(db): """Create some usable data to run against in dev.""" raw_rules = { @@ -43,7 +43,7 @@ def update_dev_data(): "example.net": Reason.MEDIA_VIDEO, "bad.example.com": Reason.MALICIOUS, } - CustomRules(request.db).load_simple_rules(raw_rules) + CustomRules(db).load_simple_rules(raw_rules) print(f"Loaded {len(raw_rules)} custom rules") @@ -55,4 +55,4 @@ def update_dev_data(): request = env["request"] with request.tm: - update_dev_data() + update_dev_data(request.db) diff --git a/checkmate/scripts/init_db.py b/checkmate/scripts/init_db.py index 388d219c..44dd00bd 100755 --- a/checkmate/scripts/init_db.py +++ b/checkmate/scripts/init_db.py @@ -103,6 +103,7 @@ def main(): if args.delete: delete(engine) + stamped = None if args.create or args.stamp: stamped = is_stamped(engine) diff --git a/tests/unit/checkmate/checker/pipeline/file_test.py b/tests/unit/checkmate/checker/pipeline/file_test.py index 9c25f78a..c75e4168 100644 --- a/tests/unit/checkmate/checker/pipeline/file_test.py +++ b/tests/unit/checkmate/checker/pipeline/file_test.py @@ -13,12 +13,12 @@ class TestReadTextFile: def test_it_reads_from_the_source(self, text_file): result = ReadTextFile()(sentinel.working_dir, source=text_file) - assert result == Any.generator.containing(["line1\n", "line2"]).only() + assert result == Any.generator().containing(["line1\n", "line2"]).only() def test_it_reads_from_a_specified_name(self, text_file): result = ReadTextFile(text_file)(sentinel.working_dir) - assert result == Any.generator.containing(["line1\n", "line2"]).only() + assert result == Any.generator().containing(["line1\n", "line2"]).only() def test_it_raises_if_not_given_a_file(self): with pytest.raises(StageException): @@ -36,12 +36,12 @@ class TestReadCSVFile: def test_it_reads_from_the_source(self, csv_file): result = ReadCSVFile()(sentinel.working_dir, source=csv_file) - assert result == Any.generator.containing([["a", "b", "c"], ["1", "2", "3"]]) + assert result == Any.generator().containing([["a", "b", "c"], ["1", "2", "3"]]) def test_it_reads_from_a_specified_name(self, csv_file): result = ReadCSVFile(csv_file)(sentinel.working_dir) - assert result == Any.generator.containing([["a", "b", "c"], ["1", "2", "3"]]) + assert result == Any.generator().containing([["a", "b", "c"], ["1", "2", "3"]]) def test_it_raises_if_not_given_a_file(self): with pytest.raises(StageException): diff --git a/tests/unit/checkmate/checker/url/allow_rules_test.py b/tests/unit/checkmate/checker/url/allow_rules_test.py index 5c47ad6a..ad03d6bb 100644 --- a/tests/unit/checkmate/checker/url/allow_rules_test.py +++ b/tests/unit/checkmate/checker/url/allow_rules_test.py @@ -25,7 +25,7 @@ def test_it_can_detect_a_missing_url(self, allow_rules): hits = allow_rules.check_url(hash_url("http://not-a-match.com")) - assert hits == Any.generator.containing([Reason.NOT_ALLOWED]).only() + assert hits == Any.generator().containing([Reason.NOT_ALLOWED]).only() @pytest.fixture def allow_rules(self, db_session): diff --git a/tests/unit/checkmate/checker/url/custom_rules_test.py b/tests/unit/checkmate/checker/url/custom_rules_test.py index 852ead26..8665af63 100644 --- a/tests/unit/checkmate/checker/url/custom_rules_test.py +++ b/tests/unit/checkmate/checker/url/custom_rules_test.py @@ -17,7 +17,7 @@ def test_it_can_fuzzy_match_a_url(self, suffix, prefix, custom_rules): hits = custom_rules.check_url(hash_url(url)) - assert hits == Any.generator.containing(rule.reasons).only() + assert hits == Any.generator().containing(rule.reasons).only() def test_it_can_match_multiple_rules(self, custom_rules): factories.CustomRule(url="http://sub.domain.com", reasons=[Reason.HIGH_IO]) @@ -26,7 +26,8 @@ def test_it_can_match_multiple_rules(self, custom_rules): hits = custom_rules.check_url(hash_url("http://sub.domain.com")) assert ( - hits == Any.generator.containing([Reason.HIGH_IO, Reason.MALICIOUS]).only() + hits + == Any.generator().containing([Reason.HIGH_IO, Reason.MALICIOUS]).only() ) @pytest.fixture diff --git a/tests/unit/checkmate/checker/url/url_haus_test.py b/tests/unit/checkmate/checker/url/url_haus_test.py index de16bc32..3f7cce14 100644 --- a/tests/unit/checkmate/checker/url/url_haus_test.py +++ b/tests/unit/checkmate/checker/url/url_haus_test.py @@ -15,7 +15,7 @@ def test_check_url_with_hits(self, URLHausRule): response = URLHaus(sentinel.db_session).check_url(["hex_hash"]) - assert response == Any.generator.containing([Reason.MALICIOUS]).only() + assert response == Any.generator().containing([Reason.MALICIOUS]).only() # The above will exhaust the generator and allow us to make assertions # about the call URLHausRule.find_matches.assert_called_once_with( @@ -27,7 +27,7 @@ def test_check_url_with_no_hits(self, URLHausRule): response = URLHaus(sentinel.db_session).check_url(["hex_hash"]) - assert response == Any.generator.containing([]).only() + assert response == Any.generator().containing([]).only() @httprettified def test_reinitialize_db(self, URLHausRule): diff --git a/tests/unit/checkmate/models/db/mixins_test.py b/tests/unit/checkmate/models/db/mixins_test.py index c1fdaaf0..1ddb1d8a 100644 --- a/tests/unit/checkmate/models/db/mixins_test.py +++ b/tests/unit/checkmate/models/db/mixins_test.py @@ -19,7 +19,7 @@ def test_it_retrieves_all(self, db_session): items = self.TableWithHash.find_matches( db_session, hex_hashes=["hash_1", "hash_3"] ) - assert [item.hash for item in items] == Any.list.containing( + assert [item.hash for item in items] == Any.list().containing( ["hash_1", "hash_3"] ).only() @@ -87,7 +87,8 @@ def test_it_can_be_upserted(self, db_session, block_size): assert ( rows - == Any.iterable.containing( + == Any.iterable() + .containing( [ Any.instance_of(self.TableWithBulkUpsert).with_attrs(expected) for expected in [ @@ -97,7 +98,8 @@ def test_it_can_be_upserted(self, db_session, block_size): {"id": 4, "name": "over_block_size", "other": "post_4"}, ] ] - ).only() + ) + .only() ) def test_it_fails_with_badly_configured_host_class(self):