Code Duplication    Length = 15-18 lines in 2 locations

anyconfig/tests/cli.py 1 location

@@ 56-73 (lines=18) @@
53
        self.run_and_check_exit_code(["--list"])
54
55
56
class Test_20_Base(Test_00_Base):
57
58
    def setUp(self):
59
        self.workdir = anyconfig.tests.common.setup_workdir()
60
        self.script = os.path.join(anyconfig.tests.common.selfdir(),
61
                                   "..", "cli.py")
62
63
    def tearDown(self):
64
        anyconfig.tests.common.cleanup_workdir(self.workdir)
65
66
    def _assert_run_and_exit(self, *args):
67
        raised = False
68
        try:
69
            _run(*args)
70
        except SystemExit:
71
            raised = True
72
73
        self.assertTrue(raised)
74
75
76
class Test_30_single_input(Test_20_Base):

anyconfig/tests/lib.py 1 location

@@ 28-42 (lines=15) @@
25
    return proc.communicate()[0]
26
27
28
class Test(unittest.TestCase):
29
30
    def setUp(self):
31
        self.workdir = anyconfig.tests.common.setup_workdir()
32
        self.script = os.path.join(self.workdir, "a.py")
33
34
    def tearDown(self):
35
        anyconfig.tests.common.cleanup_workdir(self.workdir)
36
37
    def test_00_run_script(self):
38
        with open(self.script, 'w') as fileobj:
39
            fileobj.write(SCRIPT_TO_USE_ANYCONFIG)
40
41
            out = check_output(["python", self.script])
42
            self.assertTrue(out in (b'', ''))
43
44
# vim:sw=4:ts=4:et:
45