def test_worker_good_data(tmp_path): # This test is probably useless, as it tests the what and not the how conf = copier.Worker("./tests/demo_data", tmp_path) assert conf._render_context()["_folder_name"] == tmp_path.name assert conf.all_exclusions == ("exclude1", "exclude2") assert conf.template.skip_if_exists == ["skip_if_exists1", "skip_if_exists2"] assert conf.template.tasks == ["touch 1", "touch 2"]
def test_flags_extra_fails(): key = "i_am_not_a_member" conf_data = { "src_path": "..", "dst_path": ".", key: "and_i_do_not_belong_here" } with pytest.raises(TypeError): copier.Worker(**conf_data)
def test_config_data_transclusion(): config = copier.Worker("tests/demo_transclude/demo") assert config.all_exclusions == ("exclude1", "exclude2")
def test_worker_config_precedence(tmp_path, test_input, expected_exclusions): conf = copier.Worker(dst_path=tmp_path, vcs_ref="HEAD", **test_input) assert expected_exclusions == conf.all_exclusions
def test_flags_bad_data(data): with pytest.raises(ValidationError): copier.Worker(**data)