tests.test_conda   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestConda.test_env() 0 9 2
A TestConda.test_recipe() 0 7 2
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