move all test data inside the inlined ufoLib/test modules, and install them

Since the test suite is inlined, it makes sense to also have the test data installed alongside the test modules.
So all the content of the two top-level folders Data and TestData is now placed inside Lib/ufoLib/test/testadata.
The MANIFEST.in has been adjusted accordingly.
The `install_package_data` in setup.py ensures the package data specified in the manifest is installed with the package.

This way anyone who installs ufoLib (even the wheel from PyPI) can run the test suite with `pytest --pyargs ufoLib`.
This commit is contained in:
Cosimo Lupo 2016-10-17 19:37:52 +01:00
parent 21b0f40ddc
commit 3b9ced71e0
44 changed files with 11 additions and 19 deletions

View File

@ -12,9 +12,8 @@ except NameError:
def getDemoFontPath():
"""Return the path to Data/DemoFont.ufo/."""
import ufoLib
root = os.path.dirname(os.path.dirname(os.path.dirname(ufoLib.__file__)))
return os.path.join(root, "Data", "DemoFont.ufo")
testdata = os.path.join(os.path.dirname(__file__), "testdata")
return os.path.join(testdata, "DemoFont.ufo")
def getDemoFontGlyphSetPath():

View File

@ -4139,12 +4139,8 @@ class UFO3WriteLayersTestCase(unittest.TestCase):
class UFO3ReadDataTestCase(unittest.TestCase):
def getFontPath(self):
import ufoLib
path = os.path.dirname(ufoLib.__file__)
path = os.path.dirname(path)
path = os.path.dirname(path)
path = os.path.join(path, "TestData", "UFO3-Read Data.ufo")
return path
testdata = os.path.join(os.path.dirname(__file__), "testdata")
return os.path.join(testdata, "UFO3-Read Data.ufo")
def testUFOReaderDataDirectoryListing(self):
reader = UFOReader(self.getFontPath())

View File

@ -30,12 +30,8 @@ class ConversionFunctionsTestCase(unittest.TestCase):
shutil.rmtree(path)
def getFontPath(self, fileName):
import ufoLib
path = os.path.dirname(ufoLib.__file__)
path = os.path.dirname(path)
path = os.path.dirname(path)
path = os.path.join(path, "TestData", fileName)
return path
testdata = os.path.join(os.path.dirname(__file__), "testdata")
return os.path.join(testdata, fileName)
def compareFileStructures(self, path1, path2, expectedInfoData, testFeatures):
# result

View File

@ -3,7 +3,6 @@ include README.md notes.txt LICENSE.txt
include Documentation/Makefile
recursive-include Documentation *.py *.rst
recursive-include Data *.plist *.glif
recursive-include TestData *.plist *.glif *.fea *.txt
recursive-include Lib/ufoLib/test/testdata *.plist *.glif *.fea *.txt
include requirements.txt tox.ini

View File

@ -29,6 +29,7 @@ setup_params = dict(
long_description=long_description,
package_dir={'': 'Lib'},
packages=find_packages('Lib'),
include_package_data=True,
setup_requires=pytest_runner + wheel,
tests_require=[
'pytest>=3.0.2',

View File

@ -11,5 +11,6 @@ deps =
pytest
-rrequirements.txt
commands =
# pass to pytest any extra positional arguments after `tox -- ...`
pytest {posargs}
# run the test suite against the package installed inside tox env.
# any extra positional arguments after `tox -- ...` are passed on to pytest
pytest {posargs:--pyargs ufoLib}