-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_install.py
More file actions
52 lines (46 loc) · 1.9 KB
/
test_install.py
File metadata and controls
52 lines (46 loc) · 1.9 KB
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
42
43
44
45
46
47
48
49
50
51
52
import tempfile
from pathlib import Path
from abxpkg import Binary, EnvProvider, NpmProvider, PipProvider
class TestInstall:
def test_env_provider_install_surface_uses_real_python(self, test_machine):
provider = EnvProvider(postinstall_scripts=True, min_release_age=0)
loaded = provider.load("python")
installed = provider.install("python")
loaded_or_installed = provider.install("python")
updated = provider.update("python")
uninstalled = provider.uninstall("python")
test_machine.assert_shallow_binary_loaded(loaded)
test_machine.assert_shallow_binary_loaded(installed)
test_machine.assert_shallow_binary_loaded(loaded_or_installed)
assert updated is None
assert uninstalled is False
def test_pip_binary_install_surface(self, test_machine):
with tempfile.TemporaryDirectory() as tmpdir:
binary = Binary(
name="black",
binproviders=[
PipProvider(
install_root=Path(tmpdir) / "venv",
postinstall_scripts=True,
min_release_age=0,
),
],
postinstall_scripts=True,
min_release_age=0,
)
test_machine.exercise_binary_lifecycle(binary)
def test_npm_binary_install_surface(self, test_machine):
with tempfile.TemporaryDirectory() as tmpdir:
binary = Binary(
name="zx",
binproviders=[
NpmProvider(
install_root=Path(tmpdir) / "npm",
postinstall_scripts=True,
min_release_age=0,
),
],
postinstall_scripts=True,
min_release_age=0,
)
test_machine.exercise_binary_lifecycle(binary)