Pillow/Tests/test_main.py
Jon Dufresne 2c50723f14 Convert some tests to pytest style
To better follow conventional pytest style, this removes the outer
wrapper class in favor of a function for some tests. These tests were
picked as they are relatively simple and presented no barriers to a
quick port. The assert* methods are replaced with assert statements.
When necessary, a fixture is used to create a temporary directory.

This commit does not convert the entire test suite to this style as some
test classes use methods or other advanced features that are difficult
to automatically convert. The goal is to address these issues in
followup commits.

Refs #4193
2020-01-18 12:12:10 -08:00

33 lines
873 B
Python

import os
import subprocess
import sys
def test_main():
out = subprocess.check_output([sys.executable, "-m", "PIL"]).decode("utf-8")
lines = out.splitlines()
assert lines[0] == "-" * 68
assert lines[1].startswith("Pillow ")
assert lines[2].startswith("Python ")
lines = lines[3:]
while lines[0].startswith(" "):
lines = lines[1:]
assert lines[0] == "-" * 68
assert lines[1].startswith("Python modules loaded from ")
assert lines[2].startswith("Binary modules loaded from ")
assert lines[3] == "-" * 68
jpeg = (
os.linesep
+ "-" * 68
+ os.linesep
+ "JPEG image/jpeg"
+ os.linesep
+ "Extensions: .jfif, .jpe, .jpeg, .jpg"
+ os.linesep
+ "Features: open, save"
+ os.linesep
+ "-" * 68
+ os.linesep
)
assert jpeg in out