Skip to content

Commit 3fa2418

Browse files
committed
Add test_source_distribution
1 parent 9ae3719 commit 3fa2418

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/test_distribution.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44
import textwrap
55

6-
from path import Path
6+
from path import Path, matchers
77

88
DIST_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../dist'))
99

@@ -26,6 +26,26 @@ def _check_cmake_install(virtualenv, tmpdir):
2626
assert output[:len(expected)].lower() == expected.lower()
2727

2828

29+
@pytest.mark.skipif(not Path(DIST_DIR).exists(), reason="dist directory does not exist")
30+
def test_source_distribution(virtualenv, tmpdir):
31+
sdists = Path(DIST_DIR).files(match=matchers.CaseInsensitive("*.tar.gz"))
32+
if not sdists:
33+
pytest.skip("no source distribution available")
34+
assert len(sdists) == 1
35+
36+
skbuild_configure_options = "-DCMAKE_JOB_POOL_COMPILE:STRING=compile"
37+
skbuild_configure_options += " -DCMAKE_JOB_POOL_LINK:STRING=link"
38+
skbuild_configure_options += " '-DCMAKE_JOB_POOLS:STRING=compile=4;link=3'"
39+
if os.path.exists("/usr/local/ssl"):
40+
skbuild_configure_options = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl " + skbuild_configure_options
41+
42+
virtualenv.env["SKBUILD_CONFIGURE_OPTIONS"] = skbuild_configure_options
43+
virtualenv.run("pip install %s" % sdists[0])
44+
assert "cmake" in virtualenv.installed_packages()
45+
46+
_check_cmake_install(virtualenv, tmpdir)
47+
48+
2949
@pytest.mark.skipif(not Path(DIST_DIR).exists(), reason="dist directory does not exist")
3050
def test_wheel(virtualenv, tmpdir):
3151
wheels = Path(DIST_DIR).files(match="*.whl")

0 commit comments

Comments
 (0)