Пример #1
0
 def test_disable_remember(self):
     Filter = remember(Fixture.Filter())
     c = Filter(input="f.in", output="f.out", remember_disabled=True)
     self.assertEqual(
         str(c),
         "REMEMBER_DISABLED=x remember "
         "-i /path/to/myfilter f.in -o f.out "
         "-- "
         "'/path/to/myfilter f.in f.out'")
     self.assertEqual(c.str_desc, "Filtering f.out")
Пример #2
0
 def test_hard_link(self):
     Filter = Fixture.Filter()
     Cached = remember(hard_link=True)(Filter)
     self.assertWrapper(Cached, Filter)
     self.assertRemember(Cached)
     c = Cached(input="f.in", output="f.out")
     self.assertEqual(
         str(c),
         "REMEMBER_IMEX_OPTS=hk "
         "remember "
         "-i /path/to/myfilter f.in -o f.out "
         "-- "
         "'/path/to/myfilter f.in f.out'")
     self.assertEqual(c.str_desc, "Filtering f.out [CACHED]")
     self.assertEqual(c.input, "f.in")
     self.assertEqual(c.output, KeyFile("f.out"))
     self.assertEqual(c.outputs, [KeyFile("f.out")])
     self.assertTrue(c.restat)
Пример #3
0
 def test_filter(self):
     Filter = Fixture.Filter()
     Cached = remember(Filter)
     self.assertWrapper(Cached, Filter)
     self.assertRemember(Cached)
     self.assertCountEqual(Cached.placeholders.keys(),
                           ("input", "output", "remember_outputs",
                            "remember_inputs", "remember_disabled",
                            "desc_remember_disabled",
                            "remember_hard_link"))
     self.assertCountEqual(Cached.input_placeholders.keys(), ("input",))
     self.assertCountEqual(Cached.output_placeholders.keys(), ("output",))
     c = Cached(input="f.in", output="f.out")
     self.assertEqual(
         str(c),
         "remember "
         "-i /path/to/myfilter f.in -o f.out "
         "-- "
         "'/path/to/myfilter f.in f.out'")
     self.assertEqual(c.str_desc, "Filtering f.out [CACHED]")
Пример #4
0
 def test_multio(self):
     MultiIO = Fixture.MultiIO()
     Cached = remember(MultiIO)
     self.assertWrapper(Cached, MultiIO)
     self.assertRemember(Cached)
     self.assertCountEqual(Cached.placeholders.keys(),
                           ("inp1", "inp2", "out1", "out2",
                            "threshold",
                            "remember_outputs",
                            "remember_inputs", "remember_disabled",
                            "desc_remember_disabled",
                            "remember_hard_link"))
     self.assertCountEqual(Cached.input_placeholders.keys(),
                           ("inp1", "inp2"))
     self.assertCountEqual(Cached.output_placeholders.keys(),
                           ("out1", "out2"))
     c = Cached(inp1="f1.in", inp2="f2.in", out1="f1.out", out2="f2.out",
                threshold=42)
     c_str = str(c)
     self.assertRegex(c_str, r" -i f1.in f2.in ")
     self.assertRegex(c_str, r" -o f1.out f2.out ")
     self.assertRegex(c_str, r" -- 'multio -p 42 f1.in f2.in f1.out f2.out'")
     self.assertEqual(c.str_desc, "Doing f1.out and f2.out [CACHED]")
Пример #5
0
 def test_reject_non_Command_sub_class(self):
     with self.assertRaisesRegex(TypeError,
                                 r"cmd must be a Command sub-class"):
         remember(int)
Пример #6
0
 def test_rec_quote(self):
     Prefix = remember(Fixture.Prefix())
     c = Prefix(prefix="c 2", input="f i", output="f o")
     self.assertEqual(str(c),
         """remember -i 'f i' -o 'f o' -- """\
         """'sed -e '"'"'s/^/c 2/'"'"' < '"'"'f i'"'"' > '"'"'f o'"'"''""")
Пример #7
0
 def test_wrapped_placeholder_are_not_altered(self):
     Filter = Fixture.Filter()
     Cached = remember(Filter)
     f = Filter(input="f.in", output="f.out")
     self.assertEqual(str(f), "/path/to/myfilter f.in f.out")
     self.assertEqual(f.str_desc, "Filtering f.out")