def test_help(self): with CapturedOutput() as output: with self.assertRaises(SystemExit) as cm: runmain(["--help"]) self.assertEqual(cm.exception.code, 0) self.assertTrue("arguments" in output.std) self.assertEqual(output.err, "")
def test_version(self): with CapturedOutput() as output: with self.assertRaises(SystemExit) as cm: runmain(["--version"]) self.assertEqual(cm.exception.code, 0) self.assertTrue(output.std.startswith("DEPZ")) self.assertEqual(output.err, "")
def test_relink_print_externals_multi_lines(self): with CapturedOutput() as output: runmain([ "--project", str(self.tempDir / "project"), "--relink", "-e", "multi" ]) self.assertEqual(output.std.strip(), "numpy\nrequests")
def test_relink_default(self): with CapturedOutput() as output: runmain(["--project", str(self.tempDir / "project"), "--relink"]) result = listDir((self.tempDir / "project")) self.assertListEqual(result, self.expectedPythonAfterLink) self.assertTrue("Creating symlink" in output.std)
def test_relink_layout(self): runmain([ "--project", str(self.tempDir / "project"), "--relink", "--mode", "layout" ]) result = listDir((self.tempDir / "project")) self.assertListEqual(result, self.expectedAfterLink)
def test_relink_twice(self): runmain(["--project", str(self.tempDir / "project"), "--relink"]) # removing something (self.tempDir / "project" / "lib2").unlink() # creaing links again with CapturedOutput() as output: runmain(["--project", str(self.tempDir / "project"), "--relink"]) result = listDir((self.tempDir / "project")) self.assertListEqual(result, self.expectedPythonAfterLink) self.assertTrue("Creating symlink" in output.std)
def test_scan_only(self): os.chdir(self.tempDir / "project") with CapturedOutput() as output: runmain([]) result = listDir((self.tempDir / "project")) # print("!!!!!") # pprint(result) # print(output.std) # print(output.err) self.assertListEqual(result, self.expectedUnchanged) self.assertTrue("Supposed mapping:" in output.std)
def test_project_dir_does_not_exist(self): with self.assertRaises(FileNotFoundError): runmain(["--project", "labuda"])
def _run_relink_current_dir(self): runmain(["--relink"]) result = listDir((self.tempDir / "project")) self.assertListEqual(result, self.expectedPythonAfterLink)