From fc52c5e7b6d19e4e220a36b1cd960380981f68a3 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Sun, 17 May 2020 18:53:42 +0200 Subject: [PATCH] add unit_test --- unit_test/main_tests/main_options_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/unit_test/main_tests/main_options_test.py b/unit_test/main_tests/main_options_test.py index 14252e67..b0422589 100644 --- a/unit_test/main_tests/main_options_test.py +++ b/unit_test/main_tests/main_options_test.py @@ -233,3 +233,18 @@ def test_build_selector_migrations(intercepted_build_args, monkeypatch, option_n assert intercepted_build_selector.build_patterns == build_selector_patterns else: assert intercepted_build_selector.skip_patterns == build_selector_patterns + + +@pytest.mark.parametrize('before_all', [None, 'test text']) +@pytest.mark.parametrize('platform_specific', [False, True]) +def test_before_all(before_all, platform_specific, platform, intercepted_build_args, monkeypatch): + if before_all is not None: + if platform_specific: + monkeypatch.setenv('CIBW_BEFORE_ALL_' + platform.upper(), before_all) + monkeypatch.setenv('CIBW_BEFORE_ALL', 'overwritten') + else: + monkeypatch.setenv('CIBW_BEFORE_ALL', before_all) + + main() + + assert intercepted_build_args.args[0].before_all == before_all