From 6620bf02087146c04df814ebc38b92eb1a6e2860 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 24 Apr 2023 12:59:53 +0200 Subject: [PATCH] enable black on tests: api, gpgsign, main, net, vcs --- .gitlab-ci.yml | 6 +++++- tests/gpgsign.TestCase | 1 - tests/main.TestCase | 3 +-- tests/net.TestCase | 6 +++--- tests/vcs.TestCase | 10 ++++++++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7963b56e..17da3b00 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -271,24 +271,28 @@ black: fdroidserver/tail.py fdroidserver/verify.py setup.py + tests/api.TestCase tests/build.TestCase tests/deploy.TestCase tests/dump_internal_metadata_format.py tests/exception.TestCase + tests/gpgsign.TestCase tests/import_subcommand.TestCase tests/index.TestCase tests/init.TestCase tests/install.TestCase tests/key-tricks.py tests/lint.TestCase + tests/main.TestCase tests/metadata.TestCase + tests/net.TestCase tests/nightly.TestCase tests/rewritemeta.TestCase tests/scanner.TestCase tests/signindex.TestCase + tests/vcs.TestCase tests/verify.TestCase - fedora_latest: image: fedora:latest only: diff --git a/tests/gpgsign.TestCase b/tests/gpgsign.TestCase index a4e8a0d3..ef5ea007 100755 --- a/tests/gpgsign.TestCase +++ b/tests/gpgsign.TestCase @@ -23,7 +23,6 @@ from unittest.mock import MagicMock, patch class GpgsignTest(unittest.TestCase): - basedir = Path(__file__).resolve().parent def setUp(self): diff --git a/tests/main.TestCase b/tests/main.TestCase index 914d1e2d..3809fe17 100755 --- a/tests/main.TestCase +++ b/tests/main.TestCase @@ -169,8 +169,7 @@ class MainTest(unittest.TestCase): exit_mock.assert_called_once_with(0) def test_main_prevent_plugin_override(self): - """making sure build-in subcommands cannot be overridden by plugins - """ + """making sure build-in subcommands cannot be overridden by plugins""" with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir): with open('fdroid_signatures.py', 'w') as f: f.write( diff --git a/tests/net.TestCase b/tests/net.TestCase index 0addc355..a53446bc 100755 --- a/tests/net.TestCase +++ b/tests/net.TestCase @@ -21,7 +21,6 @@ from pathlib import Path class NetTest(unittest.TestCase): - basedir = Path(__file__).resolve().parent def setUp(self): @@ -35,7 +34,8 @@ class NetTest(unittest.TestCase): @patch('requests.get') def test_download_file_url_parsing(self, requests_get): - def _get(url, stream, allow_redirects, headers, timeout): # pylint: disable=W0613 + # pylint: disable=unused-argument + def _get(url, stream, allow_redirects, headers, timeout): return MagicMock() requests_get.side_effect = _get @@ -46,7 +46,7 @@ class NetTest(unittest.TestCase): f = net.download_file( 'https://d-05.example.com/custom/com.downloader.aegis-3175421.apk?_fn=QVBLUHVyZV92My4xNy41NF9hcGtwdXJlLmNvbS5hcGs&_p=Y29tLmFwa3B1cmUuYWVnb24&am=6avvTpfJ1dMl9-K6JYKzQw&arg=downloader%3A%2F%2Fcampaign%2F%3Futm_medium%3Ddownloader%26utm_source%3Daegis&at=1652080635&k=1f6e58465df3a441665e585719ab0b13627a117f&r=https%3A%2F%2Fdownloader.com%2Fdownloader-app.html%3Ficn%3Daegis%26ici%3Dimage_qr&uu=http%3A%2F%2F172.16.82.1%2Fcustom%2Fcom.downloader.aegis-3175421.apk%3Fk%3D3fb9c4ae0be578206f6a1c330736fac1627a117f', - retries=0 + retries=0, ) self.assertTrue(requests_get.called) self.assertTrue(os.path.exists(f)) diff --git a/tests/vcs.TestCase b/tests/vcs.TestCase index 4eff7dec..2e46f926 100755 --- a/tests/vcs.TestCase +++ b/tests/vcs.TestCase @@ -74,8 +74,14 @@ class VCSTest(unittest.TestCase): vcs, build_dir = fdroidserver.common.setup_vcs(app) # force an init of the repo, the remote head error only occurs on the second gotorevision call vcs.gotorevision(build.commit) - fdroidserver.common.prepare_source(vcs, app, build, - build_dir=build_dir, srclib_dir="ignore", extlib_dir="ignore") + fdroidserver.common.prepare_source( + vcs, + app, + build, + build_dir=build_dir, + srclib_dir="ignore", + extlib_dir="ignore", + ) self.assertTrue(os.path.isfile("build/com.gpl.rpg.AndorsTrail/file"))