@@ 24-41 (lines=18) @@ | ||
21 | assert not cleanup |
|
22 | ||
23 | ||
24 | def test_local_repo_with_no_context_raises(tmp_path): |
|
25 | """A local repository without a cookiecutter.json should raise a \ |
|
26 | `RepositoryNotFound` exception.""" |
|
27 | template_path = str(Path('tests', 'fake-repo-bad')) |
|
28 | with pytest.raises(exceptions.RepositoryNotFound) as err: |
|
29 | repository.determine_repo_dir( |
|
30 | template_path, |
|
31 | abbreviations={}, |
|
32 | clone_to_dir=str(tmp_path), |
|
33 | checkout=None, |
|
34 | no_input=True, |
|
35 | ) |
|
36 | ||
37 | assert str(err.value) == ( |
|
38 | 'A valid repository for "{}" could not be found in the following ' |
|
39 | 'locations:\n{}'.format( |
|
40 | template_path, |
|
41 | '\n'.join( |
|
42 | [template_path, str(tmp_path.joinpath('tests', 'fake-repo-bad'))] |
|
43 | ), |
|
44 | ) |
|
@@ 48-65 (lines=18) @@ | ||
45 | ) |
|
46 | ||
47 | ||
48 | def test_local_repo_typo(tmp_path): |
|
49 | """An unknown local repository should raise a `RepositoryNotFound` \ |
|
50 | exception.""" |
|
51 | template_path = str(Path('tests', 'unknown-repo')) |
|
52 | with pytest.raises(exceptions.RepositoryNotFound) as err: |
|
53 | repository.determine_repo_dir( |
|
54 | template_path, |
|
55 | abbreviations={}, |
|
56 | clone_to_dir=str(tmp_path), |
|
57 | checkout=None, |
|
58 | no_input=True, |
|
59 | ) |
|
60 | ||
61 | assert str(err.value) == ( |
|
62 | 'A valid repository for "{}" could not be found in the following ' |
|
63 | 'locations:\n{}'.format( |
|
64 | template_path, |
|
65 | '\n'.join([template_path, str(tmp_path.joinpath('tests', 'unknown-repo'))]), |
|
66 | ) |
|
67 | ) |
|
68 |