def test_bscr_location(): """ Check the location of the bscr module we're loading """ pytest.debug_func() location = U.dirname(__file__, 2) bscr_loc = U.dirname(bscr.bscr.__file__, 2) assert location == bscr_loc
def test_generate_list(self): """ Generate a list from the output of a command """ with U.Chdir(U.dirname(__file__)): a = list.generate_list("ls") self.assertInList("__init__.py", a) self.assertInList("test_list.py", a) self.assertInList("test_util.py", a)
def test_bscr_help_command_pxr(capsys): """ Check the output of 'bscr help_commands' """ pytest.debug_func() ignore = ["testhelp", "toolframe", "util", "version"] result = pexpect.run("bscr help_commands") bscr_dir = U.dirname(bscr.__file__) for item in [_ for _ in glob.glob("{}/*.py".format(bscr_dir)) if '__' not in _]: name = U.basename(item.replace(".py", "")) if name not in ignore: assert name in result pass
def test_bscr_help_command_dir(capsys): """ Check the output of 'bscr help_commands' """ pytest.debug_func() ignore = ["testhelp", "toolframe", "util", "version"] bscr.bscr.bscr_help_commands(**{}) result, _ = capsys.readouterr() bscr_dir = U.dirname(bscr.__file__) for item in [x for x in glob.glob("{}/*.py".format(bscr_dir)) if '__' not in x]: name = U.basename(item.replace(".py", "")) if name not in ignore: assert name in result pass
def rshave(path, comp): while comp in path: path = U.dirname(path) return path