diff --git a/dvc/__init__.py b/dvc/__init__.py index f1b829931..e864411fe 100644 --- a/dvc/__init__.py +++ b/dvc/__init__.py @@ -33,13 +33,13 @@ if os.path.exists(os.path.join(HOMEPATH, 'setup.py')): with open(VERSIONPATH, 'w+') as fd: fd.write('# AUTOGENERATED by dvc/__init__.py\n') fd.write('version = "{}"\n'.format(__version__)) - except Exception: + except Exception: # pragma: no cover pass - else: + else: # pragma: no cover # Remove version.py so that it doesn't get into the release if os.path.exists(VERSIONPATH): os.unlink(VERSIONPATH) -else: +else: # pragma: no cover # dvc was installed with pip or something. Hopefully we have our # auto-generated version.py to help us provide a true version try: diff --git a/dvc/cli.py b/dvc/cli.py index 8c836a3a4..6f9f6315d 100644 --- a/dvc/cli.py +++ b/dvc/cli.py @@ -46,7 +46,7 @@ class DvcParser(argparse.ArgumentParser): sys.exit(2) -class VersionAction(argparse.Action): +class VersionAction(argparse.Action): # pragma: no cover def __call__(self, parser, namespace, values, option_string=None): print(VERSION) sys.exit(0) @@ -882,7 +882,7 @@ def parse_args(argv=None): and hasattr(args, 'targets') \ and len(args.targets) == 0 \ and not (hasattr(args, 'all_pipelines') - and args.all_pipelines): + and args.all_pipelines): # pragma: no cover if hasattr(args, 'cwd'): cwd = args.cwd else: @@ -900,7 +900,7 @@ def parse_args(argv=None): and len(args.deps) == 0 \ and len(args.outs) == 0 \ and len(args.outs_no_cache) == 0 \ - and len(args.command) == 0: + and len(args.command) == 0: # pragma: no cover run_parser.error("Too few arguments. Specify at least one: " "'-d', '-o', '-O', 'command'.") diff --git a/dvc/dependency/local.py b/dvc/dependency/local.py index 74b44b86b..696672a88 100644 --- a/dvc/dependency/local.py +++ b/dvc/dependency/local.py @@ -67,7 +67,8 @@ class DependencyLOCAL(DependencyBase): if not self.exists: raise self.DoesNotExistError(self.rel_path) - if not os.path.isfile(self.path) and not os.path.isdir(self.path): + if not os.path.isfile(self.path) \ + and not os.path.isdir(self.path): # pragma: no cover raise self.IsNotFileOrDirError(self.rel_path) if (os.path.isfile(self.path) and os.path.getsize(self.path) == 0) or \ diff --git a/dvc/exceptions.py b/dvc/exceptions.py index 552326428..2cadd52bb 100644 --- a/dvc/exceptions.py +++ b/dvc/exceptions.py @@ -8,7 +8,7 @@ class DvcException(Exception): if cause: try: self.cause_tb = traceback.format_exc() - except Exception: + except Exception: # pragma: no cover pass super(DvcException, self).__init__(msg) diff --git a/dvc/output/local.py b/dvc/output/local.py index 6e6018563..9bdf35c7e 100644 --- a/dvc/output/local.py +++ b/dvc/output/local.py @@ -89,7 +89,8 @@ class OutputLOCAL(DependencyLOCAL): if not os.path.exists(self.path): raise self.DoesNotExistError(self.rel_path) - if not os.path.isfile(self.path) and not os.path.isdir(self.path): + if not os.path.isfile(self.path) \ + and not os.path.isdir(self.path): # pragma: no cover raise self.IsNotFileOrDirError(self.rel_path) if (os.path.isfile(self.path) and os.path.getsize(self.path) == 0) or \ diff --git a/dvc/updater.py b/dvc/updater.py index 1b2c69d61..3648c2e4d 100644 --- a/dvc/updater.py +++ b/dvc/updater.py @@ -6,7 +6,7 @@ from dvc import VERSION_BASE from dvc.logger import Logger -class Updater(object): +class Updater(object): # pragma: no cover URL = 'https://4ki8820rsf.execute-api.us-east-2.amazonaws.com/' \ 'prod/latest-version' UPDATER_FILE = 'updater' diff --git a/tests/test_cache.py b/tests/test_cache.py index d148c4d05..e73da66ff 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -103,3 +103,12 @@ class TestSharedCacheDir(TestDir): self.assertEqual(len(os.listdir(os.path.join(cache_dir, subdirs[0]))), 1) self.assertEqual(len(os.listdir(os.path.join(cache_dir, subdirs[1]))), 1) self.assertEqual(len(os.listdir(os.path.join(cache_dir, subdirs[2]))), 1) + + +class TestCacheLinkType(TestDvc): + def test(self): + ret = main(['config', 'cache.type', 'reflink,copy']) + self.assertEqual(ret, 0) + + ret = main(['add', self.FOO]) + self.assertEqual(ret, 0) diff --git a/tests/test_checkout.py b/tests/test_checkout.py index 9e97c8935..1b15352c9 100644 --- a/tests/test_checkout.py +++ b/tests/test_checkout.py @@ -205,3 +205,15 @@ class TestCheckoutEmptyDir(TestDvc): self.assertTrue(os.path.isdir(dname)) self.assertEqual(len(os.listdir(dname)), 0) + + +class TestCheckoutNotCachedFile(TestDvc): + def test(self): + cmd = 'python {} {} {}'.format(self.CODE, self.FOO, 'out') + + self.dvc.add(self.FOO) + stage = self.dvc.run(cmd=cmd, + deps=[self.FOO, self.CODE], + outs_no_cache=['out']) + + self.dvc.checkout() diff --git a/tests/test_remote.py b/tests/test_remote.py index 87237358a..e91d90e0c 100644 --- a/tests/test_remote.py +++ b/tests/test_remote.py @@ -72,3 +72,16 @@ class TestRemoteRemoveDefault(TestDvc): core = local_config.get(Config.SECTION_CORE, None) if core is not None: self.assertTrue(Config.SECTION_CORE_REMOTE not in core.keys()) + + +class TestRemoteRemove(TestDvc): + def test(self): + ret = main(['config', 'core.jobs', '1']) + self.assertEqual(ret, 0) + + remote = 'mys3' + ret = main(['remote', 'add', remote, 's3://bucket/name']) + self.assertEqual(ret, 0) + + ret = main(['remote', 'remove', remote]) + self.assertEqual(ret, 0) diff --git a/tests/test_repro.py b/tests/test_repro.py index bfe14b9fd..ba55a949a 100644 --- a/tests/test_repro.py +++ b/tests/test_repro.py @@ -146,6 +146,12 @@ class TestReproDry(TestReproChangedData): self.assertFalse(filecmp.cmp(self.file1, self.BAR, shallow=False)) +class TestReproUpToDate(TestRepro): + def test(self): + ret = main(['repro', self.file1_stage]) + self.assertEqual(ret, 0) + + class TestReproDryNoExec(TestDvc): def test(self): deps = []