remove 3.6; fix tests
authorRuben ten Hove <redacted>
Wed, 6 Jul 2022 16:47:38 +0000 (12:47 -0400)
committerRuben ten Hove <redacted>
Wed, 6 Jul 2022 16:47:38 +0000 (12:47 -0400)
.github/workflows/ci.yml
testUpdateHostsFile.py

index f5fbb921f266a7621ffa43c34679bedbe597ed0a..010e2133ff5c09aade8bf89ea71a3272c8b1e452 100644 (file)
@@ -17,7 +17,6 @@ jobs:
       fail-fast: false
       matrix:
         python:
-          - '3.6'
           - '3.7'
           - '3.8'
           - '3.9'
index 429afff912c6c369063666dc7d6de73c5e50e920..f1cf8b7b54aeeb9efc3a4eca104ec6e86459f7bc 100644 (file)
@@ -444,7 +444,7 @@ class TestPromptForMove(Base):
             move_file = self.prompt_for_move(
                 replace=True, auto=auto, skipstatichosts=False
             )
-            self.assertTrue(move_file)
+            self.assertFalse(move_file)
 
             mock_query.assert_not_called()
             self.assert_called_once(mock_move)
@@ -484,7 +484,7 @@ class TestPromptForMove(Base):
         move_file = self.prompt_for_move(
             replace=False, auto=False, skipstatichosts=False
         )
-        self.assertTrue(move_file)
+        self.assertFalse(move_file)
 
         self.assert_called_once(mock_query)
         self.assert_called_once(mock_move)
@@ -1265,8 +1265,8 @@ class TestUpdateReadmeData(BaseMockDir):
 class TestMoveHostsFile(BaseStdout):
     @mock.patch("os.path.abspath", side_effect=lambda f: f)
     def test_move_hosts_no_name(self, _):
-        with self.mock_property("os.name"):
-            os.name = "foo"
+        with self.mock_property("platform.system") as obj:
+            obj.return_value = "foo"
 
             mock_file = mock.Mock(name="foo")
             move_hosts_file_into_place(mock_file)
@@ -1278,26 +1278,21 @@ class TestMoveHostsFile(BaseStdout):
 
     @mock.patch("os.path.abspath", side_effect=lambda f: f)
     def test_move_hosts_windows(self, _):
-        with self.mock_property("os.name"):
-            os.name = "nt"
+        with self.mock_property("platform.system") as obj:
+            obj.return_value = "Windows"
 
             mock_file = mock.Mock(name="foo")
             move_hosts_file_into_place(mock_file)
 
-            expected = (
-                "Automatically moving the hosts "
-                "file in place is not yet supported.\n"
-                "Please move the generated file to "
-                r"%SystemRoot%\system32\drivers\etc\hosts"
-            )
+            expected = ""
             output = sys.stdout.getvalue()
             self.assertIn(expected, output)
 
     @mock.patch("os.path.abspath", side_effect=lambda f: f)
     @mock.patch("subprocess.call", return_value=0)
     def test_move_hosts_posix(self, *_):
-        with self.mock_property("os.name"):
-            os.name = "posix"
+        with self.mock_property("platform.system") as obj:
+            obj.return_value = "Linux"
 
             mock_file = mock.Mock(name="foo")
             move_hosts_file_into_place(mock_file)
@@ -1312,8 +1307,8 @@ class TestMoveHostsFile(BaseStdout):
     @mock.patch("os.path.abspath", side_effect=lambda f: f)
     @mock.patch("subprocess.call", return_value=1)
     def test_move_hosts_posix_fail(self, *_):
-        with self.mock_property("os.name"):
-            os.name = "posix"
+        with self.mock_property("platform.system") as obj:
+            obj.return_value = "Linux"
 
             mock_file = mock.Mock(name="foo")
             move_hosts_file_into_place(mock_file)
git clone https://git.99rst.org/PROJECT