def test_nonexistent(self): with pytest.raises(PluginParamError): _load_from_path("./foo.bar")
def test_relative(self): assert _load_from_path("./test.txt") == "TEST"
def test_absolute(self, test_file): assert _load_from_path(os.path.abspath(test_file)) == "TEST"
def test_relative_fallback_to_cwd(self, tmpdir, base_dir): """File DOES NOT exists at given path relative to base_dir, but DOES exist relative to cwd""" assert _load_from_path("./test.txt", base_dir=base_dir) == "TEST"
def test_relative_exists(self, tmpdir, base_dir): """File exists at given path relative to base_dir""" assert _load_from_path("../test.txt", base_dir=base_dir) == "TEST"
def test_absolute(self, test_file, base_dir): """base_dir should be ignored if an absolute path is given""" assert (_load_from_path(os.path.abspath(test_file), base_dir=base_dir) == "TEST")