Commit b47713d4 authored by Michael Droettboom's avatar Michael Droettboom Committed by GitHub

Merge pull request #98 from rth/common-tests

Mechanism for testing imports
parents 367fc17c af8058c4
......@@ -5,3 +5,7 @@ package:
source:
url: https://files.pythonhosted.org/packages/c2/4b/137dea450d6e1e3d474e1d873cd1d4f7d3beed7e0dc973b06e8e10d32488/cycler-0.10.0.tar.gz
md5: 4cb42917ac5007d1cdff6cccfe2d016b
test:
imports:
- cycler
......@@ -5,3 +5,7 @@ package:
source:
url: https://files.pythonhosted.org/packages/31/60/494fcce70d60a598c32ee00e71542e52e27c978e5f8219fae0d4ac6e2864/kiwisolver-1.0.1.tar.gz
md5: e2a1718b837e2cd001f7c06934616fcd
test:
imports:
- kiwisolver
......@@ -39,3 +39,7 @@ requirements:
- pyparsing
- python-dateutil
- pytz
test:
imports:
- matplotlib
......@@ -20,3 +20,8 @@ source:
build:
cflags: -include math.h -I../../config
test:
imports:
- numpy
......@@ -17,3 +17,7 @@ requirements:
- numpy
- python-dateutil
- pytz
test:
imports:
- pandas
......@@ -8,3 +8,7 @@ source:
patches:
- patches/dummy_threading.patch
test:
imports:
- pyparsing
......@@ -8,3 +8,7 @@ source:
patches:
- patches/dummy-thread-lock.patch
test:
imports:
- dateutil
......@@ -8,3 +8,7 @@ source:
patches:
- patches/dummy-threading.patch
test:
imports:
- pytz
import pytest
import os
from pathlib import Path
import sys
BASE_DIR = Path(__file__).parent.parent
PKG_DIR = BASE_DIR / 'packages'
# TODO: remove once we have a proper Python package for common functions
sys.path.append(str(BASE_DIR / 'tools'))
import common # noqa
def registered_packages():
"""Returns a list of registred package names"""
packages = [name for name in os.listdir(PKG_DIR)
if (PKG_DIR / name).is_dir()]
return packages
def registered_packages_meta():
"""Returns a dictionary with the contents of `meta.yaml`
for each registed package
"""
packages = registered_packages
return {name: common.parse_package(PKG_DIR / name / 'meta.yaml')
for name in packages}
UNSUPPORTED_PACKAGES = {'ChromeWrapper': ['pandas'],
'FirefoxWrapper': []}
@pytest.mark.parametrize('name', registered_packages())
def test_import(name, selenium):
# check that we can parse the meta.yaml
meta = common.parse_package(PKG_DIR / name / 'meta.yaml')
if name in UNSUPPORTED_PACKAGES[selenium.__class__.__name__]:
pytest.xfail(
'{} fails to load and is not supported on {}.'
.format(name,
selenium.__class__.__name__.replace('Wrapper', '')))
for import_name in meta.get('test', {}).get('imports', []):
selenium.load_package(name)
selenium.run('import %s' % import_name)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment