From 18b1730320dd27c2b1aa06f7f5b26403da037948 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Tue, 27 Mar 2018 11:38:20 -0700 Subject: [PATCH] Skip test that requires pywin32 on *nix platforms --- tests/unit/states/test_environ.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unit/states/test_environ.py b/tests/unit/states/test_environ.py index b662d0dcb5..7f1394ba40 100644 --- a/tests/unit/states/test_environ.py +++ b/tests/unit/states/test_environ.py @@ -53,9 +53,10 @@ class TestEnvironState(TestCase, LoaderModuleMockMixin): ret = envstate.setenv('test', 'other') self.assertEqual(ret['changes'], {}) + @skipIf(not utils.is_windows(), 'Windows only') def test_setenv_permanent(self): - with patch.dict(envmodule.__salt__, {'reg.set_value': MagicMock(), 'reg.delete_value': MagicMock()}), \ - patch('salt.utils.is_windows', MagicMock(return_value=True)): + '''test that we can set perminent environment variables (requires pywin32)''' + with patch.dict(envmodule.__salt__, {'reg.set_value': MagicMock(), 'reg.delete_value': MagicMock()}): ret = envstate.setenv('test', 'value', permanent=True) self.assertEqual(ret['changes'], {'test': 'value'}) envmodule.__salt__['reg.set_value'].assert_called_with("HKCU", "Environment", 'test', 'value')