Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ include LICENSE
include Makefile
include tox.ini
graft Tests
graft Tests/images
graft checks
graft patches
graft src
Expand All @@ -28,8 +29,19 @@ exclude .editorconfig
exclude .readthedocs.yml
exclude codecov.yml
exclude renovate.json
exclude Tests/images/README.md
exclude Tests/images/crash*.tif
exclude Tests/images/string_dimension.tiff
global-exclude .git*
global-exclude *.pyc
global-exclude *.so
prune .ci
prune wheels
prune winbuild/build
prune winbuild/depends
prune Tests/errors
prune Tests/images/jpeg2000
prune Tests/images/msp
prune Tests/images/picins
prune Tests/images/sunraster
prune Tests/test-images
31 changes: 17 additions & 14 deletions Tests/test_image_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,11 @@ def test_embeddable(self) -> None:
except Exception:
pytest.skip("Compiler could not be initialized")

with open("embed_pil.c", "w", encoding="utf-8") as fh:
home = sys.prefix.replace("\\", "\\\\")
fh.write(
f"""
try:
with open("embed_pil.c", "w", encoding="utf-8") as fh:
home = sys.prefix.replace("\\", "\\\\")
fh.write(
f"""
#include "Python.h"

int main(int argc, char* argv[])
Expand All @@ -301,17 +302,19 @@ def test_embeddable(self) -> None:
return 0;
}}
"""
)
)

objects = compiler.compile(["embed_pil.c"])
compiler.link_executable(objects, "embed_pil")
objects = compiler.compile(["embed_pil.c"])
compiler.link_executable(objects, "embed_pil")

env = os.environ.copy()
env["PATH"] = sys.prefix + ";" + env["PATH"]
env = os.environ.copy()
env["PATH"] = sys.prefix + ";" + env["PATH"]

# Do not display the Windows Error Reporting dialog
getattr(ctypes, "windll").kernel32.SetErrorMode(0x0002)
# Do not display the Windows Error Reporting dialog
getattr(ctypes, "windll").kernel32.SetErrorMode(0x0002)

process = subprocess.Popen(["embed_pil.exe"], env=env)
process.communicate()
assert process.returncode == 0
process = subprocess.Popen(["embed_pil.exe"], env=env)
process.communicate()
assert process.returncode == 0
finally:
os.remove("embed_pil.c")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add teardown_method to this class to delete it, to save an indent?

https://docs.pytest.org/en/stable/how-to/xunit_setup.html#method-and-function-level-setup-teardown

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've pushed a commit.

4 changes: 1 addition & 3 deletions Tests/test_pyroma.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

from importlib.metadata import metadata

import pytest

from PIL import __version__
Expand All @@ -11,7 +9,7 @@

def test_pyroma() -> None:
# Arrange
data = pyroma.projectdata.map_metadata_keys(metadata("Pillow"))
data = pyroma.projectdata.get_data(".")

# Act
rating = pyroma.ratings.rate(data)
Expand Down
Loading