-
-
Notifications
You must be signed in to change notification settings - Fork 702
/
Copy pathtest_package_toml.py
41 lines (31 loc) · 1.13 KB
/
test_package_toml.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from package import get_build_system_from_pyproject_toml, BuildPlanManager
from pytest import raises
from unittest.mock import Mock
def test_get_build_system_from_pyproject_toml_inexistent():
assert (
get_build_system_from_pyproject_toml("fixtures/inexistent/pyproject.toml")
is None
)
def test_get_build_system_from_pyproject_toml_unknown():
assert (
get_build_system_from_pyproject_toml("fixtures/pyproject-unknown.toml") is None
)
def test_build_manager_sucess_command():
bpm = BuildPlanManager(args=Mock())
# Should not have exception raised
bpm.execute(build_plan=[["sh", "/tmp", "pwd"]], zip_stream=None, query=None)
def test_build_manager_failing_command():
bpm = BuildPlanManager(args=Mock())
with raises(Exception):
bpm.execute(
build_plan=[[["sh", "/tmp", "NOTACOMMAND"]]],
zip_stream=None,
query=None,
)
def test_get_build_system_from_pyproject_toml_poetry():
assert (
get_build_system_from_pyproject_toml(
"examples/fixtures/python-app-poetry/pyproject.toml"
)
== "poetry"
)