| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import pytest |
||
| 2 | |||
| 3 | from tests import TestResources |
||
| 4 | |||
| 5 | # noinspection PyProtectedMember |
||
| 6 | from tyrannosaurus.context import Context |
||
| 7 | from tyrannosaurus.envs import CondaEnv |
||
| 8 | from tyrannosaurus.recipes import Recipe |
||
| 9 | |||
| 10 | |||
| 11 | class TestConda: |
||
| 12 | def test_env(self): |
||
| 13 | with TestResources.temp_dir(copy_resource="fake") as path: |
||
| 14 | context = Context(path, dry_run=True) |
||
| 15 | output_env_path = path / "fakeenv.yml" |
||
| 16 | env = CondaEnv("fakeenv", False, False) |
||
| 17 | txt = "\n".join(env.create(context, output_env_path)) |
||
| 18 | assert "name: fakeenv" in txt |
||
| 19 | assert "pip:" not in txt |
||
| 20 | assert "pytest" not in txt |
||
| 21 | |||
| 22 | def test_recipe(self): |
||
| 23 | with TestResources.temp_dir(copy_resource="fake") as path: |
||
| 24 | # FYI dry run is impossible because of grayskull |
||
| 25 | context = Context(path, dry_run=True) |
||
| 26 | lines = Recipe(context).create(path / "recipes") |
||
| 27 | # TODO totally inadequate coverage |
||
| 28 | assert len(lines) > 20 |
||
| 29 | # assert " - pip >=20" in lines |
||
| 30 | # assert " - poetry >=1.1,<2.0" in lines |
||
| 31 | |||
| 32 | |||
| 33 | if __name__ == "__main__": |
||
| 34 | pytest.main() |
||
| 35 |