feat: add --only (#1098)
* fix(style): use sub recommended replacement method See https://docs.python.org/3/library/re.html#re.escape Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * feat: add --build * refactor: switch to using --only Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * docs: cover --only Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * docs: undo change to --plat for auditwheel Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * (unrelated) speed up running the unit tests based on a profile run, this speeds up the unit tests by 3x * Remove `intercepted_build_args` reliance on `platform` fixture * Add test that checks if 'only' overrides env var options * Ensure that the --only command line option overrides env vars * Fix UnboundLocalError * Test cleanups * style: typing.cast instead of plain cast * feat: add only: to the GHA Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
co-authored by
Joe Rickerby
parent
3a46bde3fb
commit
eb39da0b10
@@ -12,7 +12,13 @@ from cibuildwheel import linux, macos, util, windows
|
||||
|
||||
|
||||
class ArgsInterceptor:
|
||||
def __init__(self):
|
||||
self.call_count = 0
|
||||
self.args = None
|
||||
self.kwargs = None
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.call_count += 1
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
@@ -75,16 +81,14 @@ def platform(request, monkeypatch):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def intercepted_build_args(platform, monkeypatch):
|
||||
def intercepted_build_args(monkeypatch):
|
||||
intercepted = ArgsInterceptor()
|
||||
|
||||
if platform == "linux":
|
||||
monkeypatch.setattr(linux, "build", intercepted)
|
||||
elif platform == "macos":
|
||||
monkeypatch.setattr(macos, "build", intercepted)
|
||||
elif platform == "windows":
|
||||
monkeypatch.setattr(windows, "build", intercepted)
|
||||
else:
|
||||
raise ValueError(f"unknown platform value: {platform}")
|
||||
monkeypatch.setattr(linux, "build", intercepted)
|
||||
monkeypatch.setattr(macos, "build", intercepted)
|
||||
monkeypatch.setattr(windows, "build", intercepted)
|
||||
|
||||
return intercepted
|
||||
yield intercepted
|
||||
|
||||
# check that intercepted_build_args only ever had one set of args
|
||||
assert intercepted.call_count <= 1
|
||||
|
||||
Reference in New Issue
Block a user