Beispiel #1
0
 def test_script_args(self):
     # Test: Arbitrary commandline args are passed to the script
     scriptArgs = ['--arg', 'blah', '-v']
     sys.argv[:] = sys.argv + scriptArgs
     sleuth.main()
     passedArgs = sys.stdout.getvalue().strip().split('\n')
     self.assertEqual(passedArgs, [fakescript.__file__] + scriptArgs)
Beispiel #2
0
 def test_syspath(self):
     # Test: sys.path[0] is set to the directory where the script lives
     sleuth.main()
     scriptDir = os.path.dirname(os.path.realpath(fakescript.__file__))
     self.assertEqual(sys.path[0], scriptDir)
Beispiel #3
0
 def test_main(self):
     # Test: Settings from the config file are applied to the script
     sleuth.main()
     self.assertTrue(fakemodule.doNothing_callback.called)
     self.assertTrue(fakemodule.returnValue_callback.called)