The test suite is installed as a sub-package, so the test data must also be installed along with it. The `__file__` attribute can be missing when importing a zipped package, so we load test files with `pkg_resources.resource_filename()`.
17 lines
598 B
Python
17 lines
598 B
Python
import os
|
|
try:
|
|
from ufoLib.glifLib import GlyphSet
|
|
except ImportError:
|
|
from robofab.glifLib import GlyphSet
|
|
import pkg_resources
|
|
|
|
DATADIR = pkg_resources.resource_filename('cu2qu.test', 'data')
|
|
CUBIC_GLYPHS = GlyphSet(os.path.join(DATADIR, 'cubic'))
|
|
QUAD_GLYPHS = GlyphSet(os.path.join(DATADIR, 'quadratic'))
|
|
|
|
import unittest
|
|
# Python 3 renamed 'assertRaisesRegexp' to 'assertRaisesRegex', and fires
|
|
# deprecation warnings if a program uses the old name.
|
|
if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
|
|
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|