1
0
Fork 0
mirror of synced 2024-12-21 22:21:08 -05:00

Fix newly discovered linting errors

This commit is contained in:
Tim Byrne 2019-09-26 08:46:05 -05:00
parent 2508378617
commit d2afab6846
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12
3 changed files with 10 additions and 16 deletions

View file

@ -1,6 +1,7 @@
"""Global tests configuration and fixtures""" """Global tests configuration and fixtures"""
import collections import collections
import contextlib
import copy import copy
import distutils.dir_util # pylint: disable=no-name-in-module,import-error import distutils.dir_util # pylint: disable=no-name-in-module,import-error
import os import os
@ -50,11 +51,9 @@ def tst_host():
def tst_distro(runner): def tst_distro(runner):
"""Test session's distro""" """Test session's distro"""
distro = '' distro = ''
try: with contextlib.suppress(Exception):
run = runner(command=['lsb_release', '-si'], report=False) run = runner(command=['lsb_release', '-si'], report=False)
distro = run.out.strip() distro = run.out.strip()
except BaseException:
pass
return distro return distro
@ -141,7 +140,7 @@ def supported_local_configs(supported_configs):
return [c for c in supported_configs if c.startswith('local.')] return [c for c in supported_configs if c.startswith('local.')]
class Runner(object): class Runner():
"""Class for running commands """Class for running commands
Within yadm tests, this object should be used when running commands that Within yadm tests, this object should be used when running commands that
@ -238,7 +237,6 @@ def config_git():
os.system( os.system(
'git config user.email || ' 'git config user.email || '
'git config --global user.email "test@test.test"') 'git config --global user.email "test@test.test"')
return None
@pytest.fixture() @pytest.fixture()
@ -316,7 +314,7 @@ def yadm_y(paths):
return command_list return command_list
class DataFile(object): class DataFile():
"""Datafile object""" """Datafile object"""
def __init__(self, path, tracked=True, private=False): def __init__(self, path, tracked=True, private=False):
@ -350,10 +348,9 @@ class DataFile(object):
def relative_to(self, parent): def relative_to(self, parent):
"""Update all relative paths to this py.path""" """Update all relative paths to this py.path"""
self.__parent = parent self.__parent = parent
return
class DataSet(object): class DataSet():
"""Dataset object""" """Dataset object"""
def __init__(self): def __init__(self):
@ -444,7 +441,6 @@ class DataSet(object):
self.__relpath = relpath self.__relpath = relpath
for datafile in self.files: for datafile in self.files:
datafile.relative_to(self.__relpath) datafile.relative_to(self.__relpath)
return
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
@ -526,7 +522,6 @@ def ds1_work_copy(ds1_data, paths):
"""Function scoped copy of ds1_data.work""" """Function scoped copy of ds1_data.work"""
distutils.dir_util.copy_tree( # pylint: disable=no-member distutils.dir_util.copy_tree( # pylint: disable=no-member
str(ds1_data.work), str(paths.work)) str(ds1_data.work), str(paths.work))
return None
@pytest.fixture() @pytest.fixture()
@ -540,7 +535,6 @@ def ds1_repo_copy(runner, ds1_data, paths):
command=['git', 'config', 'core.worktree', str(paths.work)], command=['git', 'config', 'core.worktree', str(paths.work)],
env=env, env=env,
report=False) report=False)
return None
@pytest.fixture() @pytest.fixture()

View file

@ -271,4 +271,3 @@ def remote(paths, ds1_repo_copy):
# cannot be applied to another fixture. # cannot be applied to another fixture.
paths.remote.remove() paths.remote.remove()
paths.repo.move(paths.remote) paths.repo.move(paths.remote)
return None

View file

@ -27,7 +27,7 @@ def test_list(runner, yadm_y, paths, ds1, location):
assert run.success assert run.success
assert run.err == '' assert run.err == ''
returned_files = set(run.out.splitlines()) returned_files = set(run.out.splitlines())
expected_files = set([e.path for e in ds1 if e.tracked]) expected_files = {e.path for e in ds1 if e.tracked}
assert returned_files == expected_files assert returned_files == expected_files
# test without '-a' # test without '-a'
# should get all tracked files, relative to the work path unless in a # should get all tracked files, relative to the work path unless in a
@ -41,7 +41,8 @@ def test_list(runner, yadm_y, paths, ds1, location):
basepath = os.path.basename(os.getcwd()) basepath = os.path.basename(os.getcwd())
# only expect files within the subdir # only expect files within the subdir
# names should be relative to subdir # names should be relative to subdir
expected_files = set( expected_files = {
[e.path[len(basepath)+1:] for e in ds1 e.path[len(basepath)+1:]
if e.tracked and e.path.startswith(basepath)]) for e in ds1 if e.tracked and e.path.startswith(basepath)
}
assert returned_files == expected_files assert returned_files == expected_files