/usr/lib/python3/dist-packages/pyutilib/component/loader/tests/test_egg.py is in python3-pyutilib 5.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #
# Plugin load tests for eggs
#
import os
import sys
from os.path import abspath, dirname
currdir = dirname(abspath(__file__))+os.sep
import pyutilib.th as unittest
import pyutilib.subprocess
try:
import pkg_resources
pkg_resources_avail=True
except ImportError:
pkg_resources_avail=False
try:
import yaml
yaml_available = True
except ImportError:
yaml_available = False
class Test(pyutilib.th.TestCase):
def test_egg1(self):
"""Load an egg for the 'project1' project. Eggs are loaded in the 'eggs1' directory, but only the Project1 stuff is actually imported."""
pyutilib.subprocess.run([sys.executable, currdir+os.sep+"egg1.py", currdir, "json"])
self.assertMatchesJsonBaseline(currdir+"egg1.out", currdir+"egg1.jsn")
if yaml_available:
pyutilib.subprocess.run([sys.executable, currdir+os.sep+"egg1.py", currdir, "yaml"])
self.assertMatchesYamlBaseline(currdir+"egg1.out", currdir+"egg1.yml")
def test_egg2(self):
"""Load an egg for the 'project1' project. Eggs are loaded in the 'eggs1' and 'eggs2' directories, but only the Project1 and Project 3 stuff is actually imported."""
pyutilib.subprocess.run([sys.executable, currdir+os.sep+"egg2.py", currdir, "json"])
self.assertMatchesJsonBaseline(currdir+"egg2.out", currdir+"egg2.jsn")
if yaml_available:
pyutilib.subprocess.run([sys.executable, currdir+os.sep+"egg2.py", currdir, "yaml"])
self.assertMatchesYamlBaseline(currdir+"egg2.out", currdir+"egg2.yml")
# Apply class decorator explicitly, which works in Python 2.5
Test = unittest.skipIf(not pkg_resources_avail, "Cannot import 'pkg_resources'")(Test)
if __name__ == "__main__":
unittest.main()
|