Exemplo n.º 1
0
 def test_read_2(self):
     fh = tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".py")
     fh.write('print("PyJob is cool!")\n')
     fh.close()
     script = Script.read(fh.name)
     assert script.shebang == ""
     assert script.content == ['print("PyJob is cool!")']
     pytest.helpers.unlink([fh.name])
Exemplo n.º 2
0
 def test_read_3(self):
     fh = tempfile.NamedTemporaryFile(mode="w",
                                      delete=False,
                                      suffix=ScriptProperty.SHELL.suffix)
     fh.close()
     script = Script.read(fh.name)
     assert script.shebang == ""
     assert script.content == []
     pytest.helpers.unlink([fh.name])
Exemplo n.º 3
0
 def test_read_7(self):
     fh = tempfile.NamedTemporaryFile(
         mode="w",
         dir=".",
         delete=True,
         prefix="pyjob",
         suffix=ScriptProperty.SHELL.suffix,
     )
     script = Script.read(fh.name)
     fh.close()
     assert script.directory == os.getcwd()
     assert script.prefix == ""
     assert script.stem[:5] == "pyjob"
     assert script.suffix == ScriptProperty.SHELL.suffix