Skip to content

Commit f38e01e

Browse files
committed
Mechanism for testing imports
1 parent 1bdede9 commit f38e01e

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

packages/cycler/meta.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ package:
55
source:
66
url: https://files.pythonhosted.org/packages/c2/4b/137dea450d6e1e3d474e1d873cd1d4f7d3beed7e0dc973b06e8e10d32488/cycler-0.10.0.tar.gz
77
md5: 4cb42917ac5007d1cdff6cccfe2d016b
8+
9+
test:
10+
imports:
11+
- cycler

test/test_common.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import pytest
2+
import os
3+
from pathlib import Path
4+
import sys
5+
6+
BASE_DIR = Path(__file__).parent.parent
7+
PKG_DIR = BASE_DIR / 'packages'
8+
9+
# TODO: remove once we have a proper Python package for common functions
10+
sys.path.append(str(BASE_DIR / 'tools'))
11+
import common # noqa
12+
13+
14+
def registered_packages():
15+
packages = [name for name in os.listdir(PKG_DIR)
16+
if (PKG_DIR / name).is_dir()]
17+
return packages
18+
19+
20+
@pytest.mark.parametrize('name', registered_packages())
21+
def test_meta(selenium, name):
22+
# check that we can parse the meta.yaml
23+
meta = common.parse_package(PKG_DIR / name / 'meta.yaml')
24+
25+
if 'test' in meta:
26+
if 'imports' in meta['test']:
27+
# check imports
28+
for import_name in meta['test']['imports']:
29+
selenium.load_package(import_name)
30+
selenium.run('import %s' % import_name)

0 commit comments

Comments
 (0)