pyinfra 3.0.2__py2.py3-none-any.whl → 3.1.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,3 +51,24 @@ class TestInventoryApi(TestCase):
51
51
 
52
52
  assert inventory.get_host("somehost").data.override_data == "override_data"
53
53
  assert inventory.get_host("anotherhost").data.override_data == "override_data"
54
+
55
+ def test_inventory_group_data_not_shared(self):
56
+ group_data = {"test": {}}
57
+ hosts = ["hosthost", "anotherhost"]
58
+
59
+ inventory = Inventory(
60
+ (hosts, {}),
61
+ group=(hosts, group_data),
62
+ )
63
+
64
+ hosthost = inventory.get_host("hosthost")
65
+
66
+ # Test that modifying host.data.<X> *does not* stick (both on the same
67
+ # host and also other hosts).
68
+ hosthost.data.test["hi"] = "no"
69
+ assert hosthost.data.test == {}
70
+ assert inventory.get_host("anotherhost").data.test == {}
71
+
72
+ # Test that setting host.data.<X> *does* persist
73
+ hosthost.data.somethingelse = {"hello": "world"}
74
+ assert hosthost.data.somethingelse == {"hello": "world"}
@@ -38,13 +38,13 @@ class TestCliExceptions(TestCase):
38
38
  def test_no_fact_module(self):
39
39
  self.assert_cli_exception(
40
40
  ["my-server.net", "fact", "not_a_module.SomeFact"],
41
- "No such module: pyinfra.facts.not_a_module",
41
+ "No such module: not_a_module",
42
42
  )
43
43
 
44
44
  def test_no_fact_cls(self):
45
45
  self.assert_cli_exception(
46
46
  ["my-server.net", "fact", "server.NotAFact"],
47
- "No such attribute in module pyinfra.facts.server: NotAFact",
47
+ "No such attribute in module server: NotAFact",
48
48
  )
49
49
 
50
50
 
@@ -30,15 +30,13 @@ class TestCliUtil(TestCase):
30
30
  def test_setup_no_module(self):
31
31
  with self.assertRaises(CliError) as context:
32
32
  get_func_and_args(("no.op",))
33
- assert context.exception.message == "No such module: pyinfra.operations.no"
33
+ assert context.exception.message == "No such module: no"
34
34
 
35
35
  def test_setup_no_op(self):
36
36
  with self.assertRaises(CliError) as context:
37
37
  get_func_and_args(("server.no",))
38
38
 
39
- assert (
40
- context.exception.message == "No such attribute in module pyinfra.operations.server: no"
41
- )
39
+ assert context.exception.message == "No such attribute in module server: no"
42
40
 
43
41
  def test_setup_op_and_args(self):
44
42
  commands = ("pyinfra.operations.server.user", "one", "two", "hello=world")
@@ -20,9 +20,9 @@ class TestTerraformConnector(TestCase):
20
20
  with self.assertRaises(InventoryError) as context:
21
21
  list(TerraformInventoryConnector.make_names_data("output_key"))
22
22
 
23
- assert (
24
- context.exception.args[0]
25
- == "No Terraform output with key: `output_key`, valid keys:\n - hello.world"
23
+ assert context.exception.args[0] == (
24
+ "No Terraform output with key: `output_key`, "
25
+ "valid keys:\n - hello\n - hello.world"
26
26
  )
27
27
 
28
28
  @patch("pyinfra.connectors.terraform.local.shell")
@@ -58,7 +58,7 @@ class TestTerraformConnector(TestCase):
58
58
  (
59
59
  "@terraform/somehost",
60
60
  {"ssh_hostname": "somehost"},
61
- ["@terraform"],
61
+ ["@terraform", "all"],
62
62
  ),
63
63
  ]
64
64
 
@@ -71,7 +71,7 @@ class TestTerraformConnector(TestCase):
71
71
  (
72
72
  "@terraform/somehost",
73
73
  {"ssh_hostname": "somehost"},
74
- ["@terraform"],
74
+ ["@terraform", "all"],
75
75
  ),
76
76
  ]
77
77
 
@@ -88,7 +88,7 @@ class TestTerraformConnector(TestCase):
88
88
  (
89
89
  "@terraform/a name",
90
90
  {"ssh_hostname": "hostname"},
91
- ["@terraform"],
91
+ ["@terraform", "all"],
92
92
  ),
93
93
  ]
94
94