def test_is_not_pytest(self): runner = Runner("test", self._pytest_dir, RunnerType.PYTEST) self.assertFalse(runner._is_pytest())
def test_is_pytest_grep(self): with open(os.path.join(self._pytest_dir, "foo.txt"), "w") as f: f.write("foo pytest bar") runner = Runner("test", self._pytest_dir, RunnerType.PYTEST) self.assertTrue(runner._is_pytest())
def test_is_pytest_from_import(self): with open(os.path.join(self._pytest_dir, "foo.py"), "w") as f: f.write("from pytest import foo") runner = Runner("test", self._pytest_dir, RunnerType.PYTEST) self.assertTrue(runner._is_pytest())
def test_is_pytest_ini(self): with open(os.path.join(self._pytest_dir, "pytest.ini"), "w") as f: f.write("foo") runner = Runner("test", self._pytest_dir, RunnerType.PYTEST) self.assertTrue(runner._is_pytest())
def test_is_pytest_setup_test_suite_py_test(self): with open(os.path.join(self._pytest_dir, "setup.py"), "w") as f: f.write(" test_suite=py.test") runner = Runner("test", self._pytest_dir, RunnerType.PYTEST) self.assertTrue(runner._is_pytest())
def test_is_not_pytest_setup_py(self): with open(os.path.join(self._pytest_dir, "setup.py"), "w") as f: f.write(" test_suite=nose") runner = Runner("test", self._pytest_dir, RunnerType.PYTEST) self.assertFalse(runner._is_pytest())