diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 25144c49..382101ed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,10 +45,7 @@ jobs: - name: Install yt-dlp run: | case "${{ matrix.python-version }}" in - 3.4|3.5) - # don't install yt-dlp - ;; - 3.6|3.7|3.8) + 3.8) # install from PyPI pip install yt-dlp ;; @@ -60,14 +57,7 @@ jobs: - name: Lint with flake8 run: | - case "${{ matrix.python-version }}" in - 3.4|3.5|3.6|3.7) - flake8 --extend-exclude scripts/export_tests.py,scripts/pyprint.py . - ;; - *) - flake8 . - ;; - esac + flake8 . - name: Run tests run: | diff --git a/docs/configuration.rst b/docs/configuration.rst index d57cd831..a27bc5c0 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -78,8 +78,8 @@ Description If this is an ``object``, it must contain Python expressions mapping to the filename format strings to use. - These expressions are evaluated in the order as specified in Python 3.6+ - and in an undetermined order in Python 3.4 and 3.5. + These expressions are evaluated in the specified order until one evaluates + to ``True``. The available replacement keys depend on the extractor used. A list of keys for a specific one can be acquired by calling *gallery-dl* diff --git a/gallery_dl/text.py b/gallery_dl/text.py index 7725ea09..f7ecb504 100644 --- a/gallery_dl/text.py +++ b/gallery_dl/text.py @@ -317,12 +317,7 @@ else: def parse_datetime(date_string, format="%Y-%m-%dT%H:%M:%S%z", utcoffset=0): """Create a datetime object by parsing 'date_string'""" try: - if format.endswith("%z") and date_string[-3] == ":": - # workaround for Python < 3.7: +00:00 -> +0000 - ds = date_string[:-3] + date_string[-2:] - else: - ds = date_string - d = datetime.datetime.strptime(ds, format) + d = datetime.datetime.strptime(date_string, format) o = d.utcoffset() if o is not None: # convert to naive UTC diff --git a/test/test_extractor.py b/test/test_extractor.py index 88f4a9cb..2bd82129 100644 --- a/test/test_extractor.py +++ b/test/test_extractor.py @@ -198,7 +198,6 @@ class TestExtractorModule(unittest.TestCase): extr.initialize() extr.finalize() - @unittest.skipIf(sys.hexversion < 0x3060000, "test fails in CI") def test_init_ytdl(self): try: extr = extractor.find("ytdl:") diff --git a/test/test_formatter.py b/test/test_formatter.py index 6706b942..f6b5888f 100644 --- a/test/test_formatter.py +++ b/test/test_formatter.py @@ -66,10 +66,7 @@ class TestFormatter(unittest.TestCase): self._run_test("{t!d}", datetime.datetime(2010, 1, 1)) self._run_test("{t!d:%Y-%m-%d}", "2010-01-01") self._run_test("{t!D}" , datetime.datetime(2010, 1, 1)) - if sys.hexversion >= 0x3070000: - self._run_test("{ds!D}", datetime.datetime(2010, 1, 1)) - else: - self._run_test("{ds!D}", datetime.datetime(1970, 1, 1)) + self._run_test("{ds!D}", datetime.datetime(2010, 1, 1)) self._run_test("{dt!D}", datetime.datetime(2010, 1, 1)) self._run_test("{t!D:%Y-%m-%d}", "2010-01-01") self._run_test("{dt!T}", "1262304000") @@ -427,7 +424,6 @@ class TestFormatter(unittest.TestCase): self._run_test("\fE name * 2 + ' ' + a", "{}{} {}".format( self.kwdict["name"], self.kwdict["name"], self.kwdict["a"])) - @unittest.skipIf(sys.hexversion < 0x3060000, "no fstring support") def test_fstring(self): self._run_test("\fF {a}", self.kwdict["a"]) self._run_test("\fF {name}{name} {a}", "{}{} {}".format( @@ -435,7 +431,6 @@ class TestFormatter(unittest.TestCase): self._run_test("\fF foo-'\"{a.upper()}\"'-bar", """foo-'"{}"'-bar""".format(self.kwdict["a"].upper())) - @unittest.skipIf(sys.hexversion < 0x3060000, "no fstring support") def test_template_fstring(self): with tempfile.TemporaryDirectory() as tmpdirname: path1 = os.path.join(tmpdirname, "tpl1") diff --git a/test/test_postprocessor.py b/test/test_postprocessor.py index 82b6ae47..d11c142e 100644 --- a/test/test_postprocessor.py +++ b/test/test_postprocessor.py @@ -377,9 +377,7 @@ class MetadataTest(BasePostprocessorTest): path = self.pathfmt.realpath + ".JSON" m.assert_called_once_with(path, "w", encoding="utf-8") - if sys.hexversion >= 0x3060000: - # python 3.4 & 3.5 have random order without 'sort: True' - self.assertEqual(self._output(m), """{ + self.assertEqual(self._output(m), """{ "category": "test", "filename": "file", "extension": "ext", diff --git a/test/test_util.py b/test/test_util.py index 8053949f..adc41438 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -794,8 +794,6 @@ value = 123 self.assertEqual(f(["a", "b", "c"]), "a, b, c") self.assertEqual(f([1, 2, 3]), "1, 2, 3") - @unittest.skipIf(sys.hexversion < 0x3070000, - "datetime.fromisoformat") def test_to_datetime(self, f=util.to_datetime): def _assert(value, expected): @@ -1017,11 +1015,7 @@ value = 123 self.assertIsNot(p1, p2) self.assertIs(p2, p3) - - if sys.hexversion >= 0x3060000: - self.assertEqual(p1, p2) - else: - self.assertEqual(repr(p1), repr(p2)) + self.assertEqual(p1, p2) class TestExtractor():