remove 3.6; fix tests

This commit is contained in:
Ruben ten Hove 2022-07-06 12:47:38 -04:00
parent efcc6cc042
commit dccb1e220f
2 changed files with 11 additions and 17 deletions

View File

@ -17,7 +17,6 @@ jobs:
fail-fast: false
matrix:
python:
- '3.6'
- '3.7'
- '3.8'
- '3.9'

View 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)