def test_run_found_command(self): with open('hello.py', 'w') as f: f.write('print("Hello, world!")') cmd = find_command('hello') if not cmd: raise unittest.SkipTest('.py not in PATHEXT or not registered') p = capture_stdout('hello') self.assertEqual(p.stdout.text.rstrip(), 'Hello, world!')
def test_run_found_command(self): with open("hello.py", "w") as f: f.write('print("Hello, world!")') cmd = find_command("hello") if not cmd: raise unittest.SkipTest(".py not in PATHEXT or not registered") p = capture_stdout("hello") self.assertEqual(p.stdout.text.rstrip(), "Hello, world!")
def test_find_command(self): cmd = find_command('dummy.py') self.assertTrue(cmd is None or pyrunner_re.match(cmd)) cmd = find_command('dummy.pyw') self.assertTrue(cmd is None or pywrunner_re.match(cmd))