Skip to content

Commit c1a0a85

Browse files
committed
Add test_source_distribution
1 parent 9ae3719 commit c1a0a85

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/test_distribution.py

Lines changed: 16 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,21 @@ 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+
if "SETUP_CMAKE_ARGS" in os.environ:
37+
virtualenv.env["SKBUILD_CONFIGURE_OPTIONS"] = os.environ["SETUP_CMAKE_ARGS"]
38+
virtualenv.run("pip install %s" % sdists[0])
39+
assert "cmake" in virtualenv.installed_packages()
40+
41+
_check_cmake_install(virtualenv, tmpdir)
42+
43+
2944
@pytest.mark.skipif(not Path(DIST_DIR).exists(), reason="dist directory does not exist")
3045
def test_wheel(virtualenv, tmpdir):
3146
wheels = Path(DIST_DIR).files(match="*.whl")

0 commit comments

Comments
 (0)