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(): def getDemoFontPath():
"""Return the path to Data/DemoFont.ufo/.""" """Return the path to Data/DemoFont.ufo/."""
import ufoLib testdata = os.path.join(os.path.dirname(__file__), "testdata")
root = os.path.dirname(os.path.dirname(os.path.dirname(ufoLib.__file__))) return os.path.join(testdata, "DemoFont.ufo")
return os.path.join(root, "Data", "DemoFont.ufo")
def getDemoFontGlyphSetPath(): def getDemoFontGlyphSetPath():

View File

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

View File

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

View File

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

View File

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

View File

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