Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates after dropping Python 3.6 and 3.7 #1372

Merged
merged 3 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1372.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updates after dropping Python 3.6 and 3.7.
1 change: 0 additions & 1 deletion src/briefcase/integrations/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def install(self):

with self.tools.input.wait_bar("Installing OpenJDK..."):
try:
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
self.tools.shutil.unpack_archive(
os.fsdecode(jdk_zip_path),
extract_dir=os.fsdecode(self.tools.base_path),
Expand Down
1 change: 0 additions & 1 deletion src/briefcase/integrations/wix.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def install(self):

try:
with self.tools.input.wait_bar("Installing WiX..."):
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
self.tools.shutil.unpack_archive(
os.fsdecode(wix_zip_path),
extract_dir=os.fsdecode(self.wix_home),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ def test_existing_skin(mock_tools, android_sdk):

def test_new_skin(mock_tools, android_sdk):
"""If the skin doesn't exist, an attempt is made to download it."""
# MagicMock below py3.8 doesn't have __fspath__ attribute.
# Remove if block when we drop py3.7 support.
skin_tgz_path = MagicMock(spec_set=Path)
skin_tgz_path.__fspath__.return_value = "/path/to/skin.tgz"
mock_tools.download.file.return_value = skin_tgz_path
Expand Down Expand Up @@ -50,8 +48,6 @@ def test_new_skin(mock_tools, android_sdk):

def test_skin_download_failure(mock_tools, android_sdk, tmp_path):
"""If the skin download fails, an error is raised."""
# MagicMock below py3.8 doesn't have __fspath__ attribute.
# Remove if block when we drop py3.7 support.
skin_tgz_path = MagicMock(spec_set=Path)
skin_tgz_path.__fspath__.return_value = "/path/to/skin.tgz"
mock_tools.download.file.return_value = skin_tgz_path
Expand Down Expand Up @@ -79,8 +75,6 @@ def test_skin_download_failure(mock_tools, android_sdk, tmp_path):
def test_unpack_failure(mock_tools, android_sdk, tmp_path):
"""If the download is corrupted and unpacking fails, an error is raised."""
# Mock the result of the download of a skin
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
skin_tgz_path = MagicMock(spec_set=Path)
skin_tgz_path.__fspath__.return_value = "/path/to/skin.tgz"
mock_tools.download.file.return_value = skin_tgz_path
Expand Down
9 changes: 0 additions & 9 deletions tests/integrations/java/test_JDK__upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def rmtree(path):
mock_tools.shutil.rmtree.side_effect = rmtree

# Mock the cached download path.
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
archive = MagicMock()
archive.__fspath__.return_value = "/path/to/download.zip"
mock_tools.download.file.return_value = archive
Expand All @@ -87,7 +85,6 @@ def rmtree(path):
)

# The archive was unpacked.
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
"/path/to/download.zip", extract_dir=os.fsdecode(tmp_path / "tools")
)
Expand All @@ -112,8 +109,6 @@ def rmtree(path):
mock_tools.shutil.rmtree.side_effect = rmtree

# Mock the cached download path.
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
archive = MagicMock()
archive.__fspath__.return_value = "/path/to/download.zip"
mock_tools.download.file.return_value = archive
Expand All @@ -139,7 +134,6 @@ def rmtree(path):
)

# The archive was unpacked.
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
"/path/to/download.zip",
extract_dir=os.fsdecode(tmp_path / "tools"),
Expand Down Expand Up @@ -198,8 +192,6 @@ def rmtree(path):
mock_tools.shutil.rmtree.side_effect = rmtree

# Mock the cached download path
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
archive = MagicMock()
archive.__fspath__.return_value = "/path/to/download.zip"
mock_tools.download.file.return_value = archive
Expand All @@ -226,7 +218,6 @@ def rmtree(path):
)

# The archive was unpacked.
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
"/path/to/download.zip",
extract_dir=os.fsdecode(tmp_path / "tools"),
Expand Down
6 changes: 0 additions & 6 deletions tests/integrations/java/test_JDK__verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,6 @@ def test_successful_jdk_download(
mock_tools.os.environ = {"JAVA_HOME": "/does/not/exist"}

# Mock the cached download path
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
archive = mock.MagicMock()
archive.__fspath__.return_value = "/path/to/download.zip"
mock_tools.download.file.return_value = archive
Expand All @@ -477,7 +475,6 @@ def test_successful_jdk_download(
role="Java 17 JDK",
)
# The archive was unpacked
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
"/path/to/download.zip", extract_dir=os.fsdecode(tmp_path / "tools")
)
Expand Down Expand Up @@ -529,8 +526,6 @@ def test_invalid_jdk_archive(mock_tools, tmp_path):
mock_tools.host_arch = "x86_64"

# Mock the cached download path
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
archive = mock.MagicMock()
archive.__fspath__.return_value = "/path/to/download.zip"
mock_tools.download.file.return_value = archive
Expand All @@ -549,7 +544,6 @@ def test_invalid_jdk_archive(mock_tools, tmp_path):
role="Java 17 JDK",
)
# An attempt was made to unpack the archive.
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
"/path/to/download.zip",
extract_dir=os.fsdecode(tmp_path / "tools"),
Expand Down
6 changes: 0 additions & 6 deletions tests/integrations/wix/test_WiX__upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def test_existing_wix_install(mock_tools, tmp_path):
wix_path = tmp_path / "tools" / "wix"

wix_zip_path = os.fsdecode(tmp_path / "tools" / "wix.zip")
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
wix_zip = MagicMock()
wix_zip.__fspath__.return_value = wix_zip_path

Expand All @@ -75,7 +73,6 @@ def test_existing_wix_install(mock_tools, tmp_path):
)

# The download was unpacked
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
os.fsdecode(wix_zip_path), extract_dir=os.fsdecode(wix_path)
)
Expand Down Expand Up @@ -125,8 +122,6 @@ def test_unpack_fail(mock_tools, tmp_path):

# Mock the download
wix_zip_path = os.fsdecode(tmp_path / "tools" / "wix.zip")
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
wix_zip = MagicMock()
wix_zip.__fspath__.return_value = wix_zip_path

Expand All @@ -151,7 +146,6 @@ def test_unpack_fail(mock_tools, tmp_path):
)

# The download was unpacked.
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
os.fsdecode(wix_zip_path), extract_dir=os.fsdecode(wix_path)
)
Expand Down
6 changes: 0 additions & 6 deletions tests/integrations/wix/test_WiX__verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ def test_download_wix(mock_tools, tmp_path):
wix_path = tmp_path / "tools" / "wix"

wix_zip_path = os.fsdecode(tmp_path / "tools" / "wix.zip")
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
wix_zip = MagicMock()
wix_zip.__fspath__.return_value = wix_zip_path

Expand All @@ -125,7 +123,6 @@ def test_download_wix(mock_tools, tmp_path):
)

# The download was unpacked.
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
os.fsdecode(wix_zip_path), extract_dir=os.fsdecode(wix_path)
)
Expand Down Expand Up @@ -191,8 +188,6 @@ def test_unpack_fail(mock_tools, tmp_path):
wix_path = tmp_path / "tools" / "wix"

wix_zip_path = os.fsdecode(tmp_path / "tools" / "wix.zip")
# Consider to remove if block when we drop py3.7 support, only keep statements from else.
# MagicMock below py3.8 doesn't have __fspath__ attribute.
wix_zip = MagicMock()
wix_zip.__fspath__.return_value = wix_zip_path

Expand All @@ -217,7 +212,6 @@ def test_unpack_fail(mock_tools, tmp_path):
)

# The download was unpacked.
# TODO: Py3.6 compatibility; os.fsdecode not required in Py3.7
mock_tools.shutil.unpack_archive.assert_called_with(
os.fsdecode(wix_zip_path), extract_dir=os.fsdecode(wix_path)
)
Expand Down