2019-05-25 21:11:33 +03:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
from unittest import TestCase
|
|
|
|
|
2019-09-25 12:46:54 +03:00
|
|
|
from .helper import is_pypy, is_win32, on_github_actions, unittest
|
2019-09-24 19:15:31 +03:00
|
|
|
|
2019-05-25 21:11:33 +03:00
|
|
|
|
|
|
|
class TestMain(TestCase):
|
2019-09-24 19:15:31 +03:00
|
|
|
@unittest.skipIf(
|
2019-09-25 12:46:54 +03:00
|
|
|
is_win32() and is_pypy() and on_github_actions(),
|
2019-09-24 19:15:31 +03:00
|
|
|
"Failing on Windows on GitHub Actions running PyPy",
|
|
|
|
)
|
2019-05-25 21:11:33 +03:00
|
|
|
def test_main(self):
|
|
|
|
out = subprocess.check_output([sys.executable, "-m", "PIL"]).decode("utf-8")
|
|
|
|
lines = out.splitlines()
|
|
|
|
self.assertEqual(lines[0], "-" * 68)
|
|
|
|
self.assertTrue(lines[1].startswith("Pillow "))
|
2019-10-12 17:01:18 +03:00
|
|
|
self.assertTrue(lines[2].startswith("Python "))
|
|
|
|
lines = lines[3:]
|
|
|
|
while lines[0].startswith(" "):
|
|
|
|
lines = lines[1:]
|
|
|
|
self.assertEqual(lines[0], "-" * 68)
|
|
|
|
self.assertTrue(lines[1].startswith("Python modules loaded from "))
|
|
|
|
self.assertTrue(lines[2].startswith("Binary modules loaded from "))
|
|
|
|
self.assertEqual(lines[3], "-" * 68)
|
2019-05-25 21:11:33 +03:00
|
|
|
jpeg = (
|
2019-06-22 07:47:56 +03:00
|
|
|
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
|
2019-05-25 21:11:33 +03:00
|
|
|
)
|
|
|
|
self.assertIn(jpeg, out)
|