def test_load_module_complains_missing_module_name(load_yaml): randomPath = str(random.randint(0, 1000)) load_yaml.return_value = {"Module": {}, "Skills": []} expected_error = 'Module file "{}/module.yaml" needs to have module name'.format( randomPath) with pytest.raises(RuntimeError, match=expected_error): _load_module(randomPath, fakes.course1)
def test_load_module_complains_about_an_empty_file(load_yaml): randomPath = str(random.randint(0, 1000)) load_yaml.return_value = None with pytest.raises( RuntimeError, match='Module file "{}/module.yaml" is empty or does not exist'. format(randomPath)): _load_module(randomPath, fakes.course1)
def call_function(self): self.fake_path = self.fake_path / "modules" / "foo" self.fake_path.mkdir(parents=True) self.create_fake_module_meta(self.fake_path, **{ **self.fake_values, }) self.result = _load_module(self.fake_path, fakes.course1)