-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Henry Schreiner <[email protected]>
- Loading branch information
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
import tarfile | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
pytest.importorskip("flit") | ||
pytest.importorskip("build") | ||
|
||
# This test must be run from the source directory - okay to skip if not | ||
DIR = os.path.abspath(os.path.dirname(__file__)) | ||
MAIN_DIR = os.path.dirname(DIR) | ||
|
||
|
||
def test_compare_sdists(monkeypatch, tmpdir): | ||
monkeypatch.chdir(MAIN_DIR) | ||
|
||
sdist_build_dir = os.path.join(str(tmpdir), "bdir") | ||
|
||
subprocess.run( | ||
[ | ||
sys.executable, | ||
"-m", | ||
"build", | ||
"--sdist", | ||
"--no-isolation", | ||
f"--outdir={sdist_build_dir}", | ||
], | ||
check=True, | ||
) | ||
|
||
(sdist_build,) = Path(sdist_build_dir).glob("*.tar.gz") | ||
|
||
# Flit doesn't allow targeting directories, as far as I can tell | ||
subprocess.run( | ||
[sys.executable, "-m", "flit", "build", "--format=sdist"], check=True | ||
) | ||
|
||
(sdist_flit,) = Path("dist").glob("*.tar.gz") | ||
|
||
out = [set(), set()] | ||
for i, sdist in enumerate([sdist_build, sdist_flit]): | ||
with tarfile.open(str(sdist), "r:gz") as tar: | ||
out[i] = set(tar.getnames()) | ||
|
||
assert out[0] == (out[1] - {"setup.py"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters