Skip to content

Commit

Permalink
skip removal tests in Python<3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
spyoungtech committed Jul 14, 2022
1 parent 7579ace commit ebc1925
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_unasync.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import shutil
import subprocess
import sys

import pytest

Expand Down Expand Up @@ -36,7 +37,8 @@ def test_rule_on_short_path():

@pytest.mark.parametrize("source_file", TEST_FILES)
def test_unasync(tmpdir, source_file):

if source_file == 'removals.py' and sys.version_info[2] < 8:
pytest.skip("unasync: remove feature is not supported in versions of Python less than 3.8")
rule = unasync.Rule(fromdir=ASYNC_DIR, todir=str(tmpdir))
rule._unasync_file(os.path.join(ASYNC_DIR, source_file))

Expand All @@ -56,6 +58,8 @@ def test_unasync_files(tmpdir):
)

for source_file in TEST_FILES:
if source_file == 'removals.py' and sys.version_info[2] < 8:
continue # unasync-remove feature is not supported in versions of Python less than 3.8
encoding = "latin-1" if "encoding" in source_file else "utf-8"
with io.open(os.path.join(SYNC_DIR, source_file), encoding=encoding) as f:
truth = f.read()
Expand Down

0 comments on commit ebc1925

Please # to comment.