1
0
Fork 0
mirror of synced 2024-12-04 14:45:36 -05:00

Lint using isort

This commit is contained in:
Tim Byrne 2023-07-10 09:14:33 -05:00
parent bbc1ca17f0
commit 7af2af52ae
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12
19 changed files with 36 additions and 2 deletions

View file

@ -7,7 +7,8 @@ import os
import platform
import pwd
import shutil
from subprocess import Popen, PIPE
from subprocess import PIPE, Popen
import py
import pytest
@ -34,6 +35,12 @@ def pylint_version():
return '2.17.0'
@pytest.fixture(scope='session')
def isort_version():
"""Version of isort supported"""
return '5.12.0'
@pytest.fixture(scope='session')
def flake8_version():
"""Version of flake8 supported"""

View file

@ -1,6 +1,7 @@
"""Test alt"""
import os
import string
import py
import pytest
import utils

View file

@ -1,6 +1,7 @@
"""Test yadm.alt-copy"""
import os
import pytest

View file

@ -2,6 +2,7 @@
import os
import re
import pytest
pytestmark = pytest.mark.usefixtures('ds1_copy')

View file

@ -2,6 +2,7 @@
import os
import re
import pytest
BOOTSTRAP_CODE = 123

View file

@ -1,6 +1,7 @@
"""Test config"""
import os
import pytest
TEST_SECTION = 'test'

View file

@ -3,6 +3,7 @@
import os
import shlex
import time
import pytest
KEY_FILE = 'test/test_key'

View file

@ -1,6 +1,7 @@
"""Test enter"""
import os
import pytest

View file

@ -1,6 +1,7 @@
"""Test git"""
import re
import pytest

View file

@ -1,6 +1,7 @@
"""Test list"""
import os
import pytest

View file

@ -1,6 +1,7 @@
"""Test perms"""
import os
import pytest

View file

@ -1,6 +1,7 @@
"""Syntax checks"""
import os
import pytest
@ -34,6 +35,16 @@ def test_pylint(pytestconfig, runner, pylint_version):
assert run.success
def test_isort(pytestconfig, runner, isort_version):
"""Passes isort"""
if not pytestconfig.getoption("--force-linters"):
run = runner(command=['isort', '--version'], report=False)
if isort_version not in run.out:
pytest.skip('Unsupported isort version')
run = runner(command=['isort', '-c', 'test'])
assert run.success
def test_flake8(pytestconfig, runner, flake8_version):
"""Passes flake8"""
if not pytestconfig.getoption("--force-linters"):

View file

@ -1,5 +1,6 @@
"""Unit tests: copy_perms"""
import os
import pytest
OCTAL = '7654'

View file

@ -1,5 +1,6 @@
"""Unit tests: remove_stale_links"""
import os
import pytest

View file

@ -1,5 +1,6 @@
"""Unit tests: template_j2cli & template_envtpl"""
import os
import pytest
FILE_MODE = 0o754

View file

@ -1,6 +1,7 @@
"""Unit tests: yadm.[git,gpg]-program"""
import os
import pytest

View file

@ -1,6 +1,7 @@
"""Test upgrade"""
import os
import pytest

View file

@ -1,6 +1,7 @@
"""Test version"""
import re
import pytest

View file

@ -3,8 +3,8 @@
This module holds values/functions common to multiple tests.
"""
import re
import os
import re
ALT_FILE1 = 'test_alt'
ALT_FILE2 = 'test alt/test alt'