1
1
from __future__ import annotations
2
2
3
- import ast
4
3
import os
5
4
import platform
6
5
import re
12
11
13
12
from pathlib import Path
14
13
from typing import TYPE_CHECKING
15
- from typing import Any
16
14
from typing import Iterator
17
15
18
16
import pytest
@@ -540,30 +538,10 @@ def test_package_with_include(mocker: MockerFixture) -> None:
540
538
assert "with_include-1.2.3/package_with_include/__init__.py" in names
541
539
assert "with_include-1.2.3/tests/__init__.py" in names
542
540
assert "with_include-1.2.3/pyproject.toml" in names
543
- assert "with_include-1.2.3/setup.py" in names
544
541
assert "with_include-1.2.3/PKG-INFO" in names
545
542
assert "with_include-1.2.3/for_wheel_only/__init__.py" not in names
546
543
assert "with_include-1.2.3/src/src_package/__init__.py" in names
547
544
548
- file = tar .extractfile ("with_include-1.2.3/setup.py" )
549
- assert file
550
- setup = file .read ()
551
- setup_ast = ast .parse (setup )
552
-
553
- setup_ast .body = [n for n in setup_ast .body if isinstance (n , ast .Assign )]
554
- ns : dict [str , Any ] = {}
555
- exec (compile (setup_ast , filename = "setup.py" , mode = "exec" ), ns )
556
- assert ns ["package_dir" ] == {"" : "src" }
557
- assert ns ["packages" ] == [
558
- "extra_dir" ,
559
- "extra_dir.sub_pkg" ,
560
- "package_with_include" ,
561
- "src_package" ,
562
- "tests" ,
563
- ]
564
- assert ns ["package_data" ] == {"" : ["*" ]}
565
- assert ns ["modules" ] == ["my_module" ]
566
-
567
545
whl = module_path / "dist" / "with_include-1.2.3-py3-none-any.whl"
568
546
569
547
assert whl .exists ()
@@ -612,7 +590,6 @@ def test_respect_format_for_explicit_included_files() -> None:
612
590
in names
613
591
)
614
592
assert "exclude_whl_include_sdist-0.1.0/pyproject.toml" in names
615
- assert "exclude_whl_include_sdist-0.1.0/setup.py" in names
616
593
assert "exclude_whl_include_sdist-0.1.0/PKG-INFO" in names
617
594
618
595
whl = module_path / "dist" / "exclude_whl_include_sdist-0.1.0-py3-none-any.whl"
@@ -625,5 +602,3 @@ def test_respect_format_for_explicit_included_files() -> None:
625
602
assert "exclude_whl_include_sdist/compiled/source.c" not in names
626
603
assert "exclude_whl_include_sdist/compiled/source.h" not in names
627
604
assert "exclude_whl_include_sdist/cython_code.pyx" not in names
628
-
629
- pass
0 commit comments