| Total Complexity | 4 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import pytest |
||
| 2 | |||
| 3 | # noinspection PyProtectedMember |
||
| 4 | from tyrannosaurus.context import Context |
||
| 5 | from tyrannosaurus.enums import DevStatus |
||
| 6 | from tyrannosaurus.new import New |
||
| 7 | |||
| 8 | from tests import TestResources |
||
| 9 | |||
| 10 | |||
| 11 | class TestNew: |
||
| 12 | def test_new_latest(self): |
||
| 13 | self._test_it(tyranno_vr="latest") |
||
| 14 | |||
| 15 | # def test_new_version(self): |
||
| 16 | # self._test_it(tyranno_vr="0.9.0") |
||
| 17 | |||
| 18 | def test_new_latest_track(self): |
||
| 19 | self._test_it(should_track=True) |
||
| 20 | |||
| 21 | def _test_it(self, should_track=False, tyranno_vr="latest"): |
||
| 22 | project = "tempted2temp" |
||
| 23 | with TestResources.temp_dir() as parent: |
||
| 24 | path = parent / project |
||
| 25 | New( |
||
| 26 | name=project, |
||
| 27 | license_name="apache2", |
||
| 28 | username="user", |
||
| 29 | authors=["Author 1"], |
||
| 30 | description="A description", |
||
| 31 | keywords=["some", "keywords"], |
||
| 32 | version="0.1.0", |
||
| 33 | status=DevStatus.alpha, |
||
| 34 | should_track=should_track, |
||
| 35 | extras=False, |
||
| 36 | tyranno_vr=tyranno_vr, |
||
| 37 | ).create(path) |
||
| 38 | assert (path / "pyproject.toml").exists() |
||
| 39 | context = Context(path, dry_run=True) |
||
| 40 | assert context.project == project |
||
| 41 | |||
| 42 | |||
| 43 | if __name__ == "__main__": |
||
| 44 | pytest.main() |
||
| 45 |