From 176e7f7f3a6a16bc09ec58d4bbc8dc515c48a0a8 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sat, 16 Mar 2024 16:32:20 -0400 Subject: [PATCH 1/3] chore[ci]: enable python3.12 tests (#3860) add a python3.12 job in the CI. also: - update dependencies - update tests for new dependencies - refactor the grammar tests to use less filtering - python3.12 deprecates the "n" field on constants; remove it --- .github/workflows/test.yml | 13 ++++-- setup.py | 8 ++-- .../functional/builtins/codegen/test_slice.py | 17 +++++--- .../builtins/folding/test_powmod.py | 2 +- .../codegen/types/test_bytes_zero_padding.py | 2 +- tests/functional/grammar/test_grammar.py | 42 +++++++++---------- tests/functional/syntax/test_structs.py | 10 ++--- vyper/ast/nodes.py | 2 - vyper/ast/parse.py | 12 +++--- 9 files changed, 59 insertions(+), 49 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7030cf45bc..cb7a054a41 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,9 @@ jobs: - name: Install Dependencies run: pip install .[lint] + - name: Debug dependencies + run: pip freeze + - name: Run Black run: black --check -C --force-exclude=vyper/version.py ./vyper ./tests ./setup.py @@ -93,9 +96,10 @@ jobs: opt-mode: gas debug: false evm-version: shanghai - - # TODO 3.12 doesn't work yet, investigate - may be hypothesis issue - #- python-version: ["3.12", "312"] + - python-version: ["3.12", "312"] + opt-mode: gas + debug: false + evm-version: shanghai name: py${{ matrix.python-version[1] }}-opt-${{ matrix.opt-mode }}${{ matrix.debug && '-debug' || '' }}-${{ matrix.evm-version }} @@ -114,6 +118,9 @@ jobs: - name: Install dependencies run: pip install .[test] + - name: Debug dependencies + run: pip freeze + - name: Run tests run: | pytest \ diff --git a/setup.py b/setup.py index 0f9a1e1dfc..b0f7ef15f2 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ extras_require = { "test": [ - "pytest>=6.2.5,<7.0", + "pytest>=8.0,<9.0", "pytest-cov>=2.10,<3.0", "pytest-instafail>=0.4,<1.0", "pytest-xdist>=2.5,<3.0", @@ -19,8 +19,9 @@ "web3==6.0.0", "tox>=3.15,<4.0", "lark==1.1.9", - "hypothesis[lark]>=5.37.1,<6.0", - "eth-stdlib==0.2.6", + "hypothesis[lark]>=6.0,<7.0", + "eth-stdlib==0.2.7", + "setuptools", ], "lint": [ "black==23.12.0", @@ -115,6 +116,7 @@ def _global_version(version): "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], package_data={"vyper.ast": ["grammar.lark"]}, data_files=[("", [hash_file_rel_path])], diff --git a/tests/functional/builtins/codegen/test_slice.py b/tests/functional/builtins/codegen/test_slice.py index 0c5a8fc485..9fc464ed35 100644 --- a/tests/functional/builtins/codegen/test_slice.py +++ b/tests/functional/builtins/codegen/test_slice.py @@ -2,7 +2,8 @@ import pytest from hypothesis import given, settings -from vyper.compiler.settings import OptimizationLevel +from vyper.compiler import compile_code +from vyper.compiler.settings import OptimizationLevel, Settings from vyper.exceptions import ArgumentException, TypeMismatch _fun_bytes32_bounds = [(0, 32), (3, 29), (27, 5), (0, 5), (5, 3), (30, 2)] @@ -32,6 +33,12 @@ def slice_tower_test(inp1: Bytes[50]) -> Bytes[50]: _bytes_1024 = st.binary(min_size=0, max_size=1024) +def _fail_contract(code, opt_level, exceptions): + settings = Settings(optimize=opt_level) + with pytest.raises(exceptions): + compile_code(code, settings) + + @pytest.mark.parametrize("use_literal_start", (True, False)) @pytest.mark.parametrize("use_literal_length", (True, False)) @pytest.mark.parametrize("opt_level", list(OptimizationLevel)) @@ -40,7 +47,6 @@ def slice_tower_test(inp1: Bytes[50]) -> Bytes[50]: @pytest.mark.fuzzing def test_slice_immutable( get_contract, - assert_compile_failed, tx_failed, opt_level, bytesdata, @@ -76,7 +82,8 @@ def _get_contract(): or (use_literal_start and start > length_bound) or (use_literal_length and length == 0) ): - assert_compile_failed(lambda: _get_contract(), ArgumentException) + _fail_contract(code, opt_level, ArgumentException) + elif start + length > len(bytesdata) or (len(bytesdata) > length_bound): # deploy fail with tx_failed(): @@ -95,7 +102,6 @@ def _get_contract(): @pytest.mark.fuzzing def test_slice_bytes_fuzz( get_contract, - assert_compile_failed, tx_failed, opt_level, location, @@ -173,7 +179,8 @@ def _get_contract(): ) if compile_time_oob or slice_output_too_large: - assert_compile_failed(lambda: _get_contract(), (ArgumentException, TypeMismatch)) + _fail_contract(code, opt_level, (ArgumentException, TypeMismatch)) + elif location == "code" and len(bytesdata) > length_bound: # deploy fail with tx_failed(): diff --git a/tests/functional/builtins/folding/test_powmod.py b/tests/functional/builtins/folding/test_powmod.py index ad1197e8e3..3235699818 100644 --- a/tests/functional/builtins/folding/test_powmod.py +++ b/tests/functional/builtins/folding/test_powmod.py @@ -4,7 +4,7 @@ from tests.utils import parse_and_fold -st_uint256 = st.integers(min_value=0, max_value=2**256) +st_uint256 = st.integers(min_value=0, max_value=(2**256 - 1)) @pytest.mark.fuzzing diff --git a/tests/functional/codegen/types/test_bytes_zero_padding.py b/tests/functional/codegen/types/test_bytes_zero_padding.py index 6597facd1b..40bd1de6fc 100644 --- a/tests/functional/codegen/types/test_bytes_zero_padding.py +++ b/tests/functional/codegen/types/test_bytes_zero_padding.py @@ -25,7 +25,7 @@ def get_count(counter: uint256) -> Bytes[24]: @pytest.mark.fuzzing -@hypothesis.given(value=hypothesis.strategies.integers(min_value=0, max_value=2**64)) +@hypothesis.given(value=hypothesis.strategies.integers(min_value=0, max_value=(2**64 - 1))) def test_zero_pad_range(little_endian_contract, value): actual_bytes = value.to_bytes(8, byteorder="little") contract_bytes = little_endian_contract.get_count(value) diff --git a/tests/functional/grammar/test_grammar.py b/tests/functional/grammar/test_grammar.py index 351793b28e..716986ffe4 100644 --- a/tests/functional/grammar/test_grammar.py +++ b/tests/functional/grammar/test_grammar.py @@ -37,36 +37,31 @@ def test_basic_grammar_empty(): assert len(tree.children) == 0 -def utf8_encodable(terminal: str) -> bool: - try: - if "\x00" not in terminal and "\\ " not in terminal and "\x0c" not in terminal: - terminal.encode("utf-8-sig") - return True - else: - return False - except UnicodeEncodeError: # pragma: no cover - # Very rarely, a "." in some terminal regex will generate a surrogate - # character that cannot be encoded as UTF-8. We apply this filter to - # ensure it doesn't happen at runtime, but don't worry about coverage. - return False +def fix_terminal(terminal: str) -> bool: + # these throw exceptions in the grammar + for bad in ("\x00", "\\ ", "\x0c"): + terminal = terminal.replace(bad, " ") + return terminal + + +ALLOWED_CHARS = st.characters(codec="utf-8", min_codepoint=1) # With help from hyposmith # https://github.com/Zac-HD/hypothesmith/blob/master/src/hypothesmith/syntactic.py class GrammarStrategy(LarkStrategy): def __init__(self, grammar, start, explicit_strategies): - super().__init__(grammar, start, explicit_strategies) + super().__init__(grammar, start, explicit_strategies, alphabet=ALLOWED_CHARS) self.terminal_strategies = { - k: v.map(lambda s: s.replace("\0", "")).filter(utf8_encodable) - for k, v in self.terminal_strategies.items() # type: ignore + k: v.map(fix_terminal) for k, v in self.terminal_strategies.items() # type: ignore } def draw_symbol(self, data, symbol, draw_state): # type: ignore - count = len(draw_state.result) + count = len(draw_state) super().draw_symbol(data, symbol, draw_state) try: compile( - source="".join(draw_state.result[count:]) + source="".join(draw_state[count:]) .replace("contract", "class") .replace("struct", "class"), # HACK: Python ast.parse filename="", @@ -102,10 +97,11 @@ def has_no_docstrings(c): @pytest.mark.fuzzing -@given(code=from_grammar().filter(lambda c: utf8_encodable(c))) -@hypothesis.settings(max_examples=500, suppress_health_check=[HealthCheck.too_slow]) +@given(code=from_grammar()) +@hypothesis.settings( + max_examples=500, suppress_health_check=[HealthCheck.too_slow, HealthCheck.filter_too_much] +) def test_grammar_bruteforce(code): - if utf8_encodable(code): - _, _, _, reformatted_code = pre_parse(code + "\n") - tree = parse_to_ast(reformatted_code) - assert isinstance(tree, Module) + _, _, _, reformatted_code = pre_parse(code + "\n") + tree = parse_to_ast(reformatted_code) + assert isinstance(tree, Module) diff --git a/tests/functional/syntax/test_structs.py b/tests/functional/syntax/test_structs.py index d34a4a6c58..9a9a397c48 100644 --- a/tests/functional/syntax/test_structs.py +++ b/tests/functional/syntax/test_structs.py @@ -589,9 +589,9 @@ def foo(): with warnings.catch_warnings(record=True) as w: assert compiler.compile_code(code) is not None - expected = "Instantiating a struct using a dictionary is deprecated " - expected += "as of v0.4.0 and will be disallowed in a future release. " - expected += "Use kwargs instead e.g. Foo(a=1, b=2)" + expected = "Instantiating a struct using a dictionary is deprecated " + expected += "as of v0.4.0 and will be disallowed in a future release. " + expected += "Use kwargs instead e.g. Foo(a=1, b=2)" - assert len(w) == 1 - assert str(w[0].message).startswith(expected) + assert len(w) == 1, [s.message for s in w] + assert str(w[0].message).startswith(expected) diff --git a/vyper/ast/nodes.py b/vyper/ast/nodes.py index 02c7e15686..5079303cd3 100644 --- a/vyper/ast/nodes.py +++ b/vyper/ast/nodes.py @@ -774,7 +774,6 @@ def is_literal_value(self): class Num(Constant): # inherited class for all numeric constant node types __slots__ = () - _translated_fields = {"n": "value"} @property def n(self): @@ -843,7 +842,6 @@ class Hex(Constant): """ __slots__ = () - _translated_fields = {"n": "value"} def validate(self): if "_" in self.value: diff --git a/vyper/ast/parse.py b/vyper/ast/parse.py index 787b1404e6..a4a8617730 100644 --- a/vyper/ast/parse.py +++ b/vyper/ast/parse.py @@ -435,7 +435,7 @@ def visit_Num(self, node): node.col_offset, ) node.ast_type = "Hex" - node.n = value + node.value = value elif value.lower()[:2] == "0b": node.ast_type = "Bytes" @@ -449,15 +449,15 @@ def visit_Num(self, node): ) node.value = int(value, 2).to_bytes(len(value) // 8, "big") - elif isinstance(node.n, float): + elif isinstance(node.value, float): node.ast_type = "Decimal" - node.n = Decimal(value) + node.value = Decimal(value) - elif isinstance(node.n, int): + elif isinstance(node.value, int): node.ast_type = "Int" - else: - raise CompilerPanic(f"Unexpected type for Constant value: {type(node.n).__name__}") + else: # pragma: nocover + raise CompilerPanic(f"Unexpected type for Constant value: {type(node.value).__name__}") return node From 8f05b4e64fe4d04c73645862451d4468111a732c Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sun, 17 Mar 2024 15:56:19 -0400 Subject: [PATCH 2/3] chore[ci]: refactor jobs to use gh actions (#3863) - roll memorymock tests into main test job - get rid of tox environment for memorymock - get rid of tox environments for fuzz and docs, move them to github actions this gets rid of tox entirely! --- .github/workflows/test.yml | 69 +++++++++---------- .pre-commit-config.yaml | 2 +- pyproject.toml | 1 - setup.cfg | 1 - setup.py | 3 +- .../codegen/test_selector_table_stability.py | 2 +- tox.ini | 29 -------- 7 files changed, 34 insertions(+), 73 deletions(-) delete mode 100644 tox.ini diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb7a054a41..c028fbd2cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,11 +53,12 @@ jobs: python-version: "3.11" cache: "pip" - - name: Install Tox - run: pip install tox + - name: Install deps + # TODO these should really be in setup.py + run: pip install shibuya sphinx sphinx-copybutton - - name: Run Tox - run: TOXENV=docs tox -r + - name: Run docs + run: sphinx-build -E -b html docs dist/docs -n -q --color # "Regular"/core tests. tests: @@ -68,6 +69,7 @@ jobs: opt-mode: ["gas", "none", "codesize"] evm-version: [shanghai] debug: [true, false] + memorymock: [false] # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations include: @@ -80,16 +82,27 @@ jobs: debug: false opt-mode: gas evm-version: paris + + # redundant rule, for clarity - python-version: ["3.11", "311"] debug: false opt-mode: gas evm-version: shanghai + # enable when py-evm makes it work: #- python-version: ["3.11", "311"] # debug: false # opt-mode: gas # evm-version: cancun + # run with `--memorymock`, but only need to do it one configuration + # TODO: consider removing the memorymock tests + - python-version: ["3.11", "311"] + opt-mode: gas + debug: false + evm-version: shanghai + memorymock: true + # run across other python versions. we don't really need to run all # modes across all python versions - one is enough - python-version: ["3.10", "310"] @@ -101,7 +114,7 @@ jobs: debug: false evm-version: shanghai - name: py${{ matrix.python-version[1] }}-opt-${{ matrix.opt-mode }}${{ matrix.debug && '-debug' || '' }}-${{ matrix.evm-version }} + name: py${{ matrix.python-version[1] }}-opt-${{ matrix.opt-mode }}${{ matrix.debug && '-debug' || '' }}${{ matrix.memorymock && '-memorymock' || '' }}-${{ matrix.evm-version }} steps: - uses: actions/checkout@v4 @@ -128,6 +141,7 @@ jobs: --optimize ${{ matrix.opt-mode }} \ --evm-version ${{ matrix.evm-version }} \ ${{ matrix.debug && '--enable-compiler-debug-mode' || '' }} \ + ${{ matrix.memorymock && '--memorymock' || '' }} \ --showlocals -r aR \ tests/ @@ -168,17 +182,23 @@ jobs: python-version: "3.11" cache: "pip" - - name: Install Tox - run: pip install tox + - name: Install dependencies + run: pip install .[test] # fetch test durations # NOTE: if the tests get poorly distributed, run this and commit the resulting `.test_durations` file to the `vyper-test-durations` repo. - # `TOXENV=fuzzing tox -r -- --store-durations -r aR tests/` + # `pytest -m "fuzzing" --store-durations -r aR tests/` - name: Fetch test-durations - run: curl --location "https://raw.githubusercontent.com/vyperlang/vyper-test-durations/5982755ee8459f771f2e8622427c36494646e1dd/test_durations" -o .test_durations + run: curl --location "https://raw.githubusercontent.com/vyperlang/vyper-test-durations/master/test_durations" -o .test_durations - - name: Run Tox - run: TOXENV=fuzzing tox -r -- --splits 60 --group ${{ matrix.group }} --splitting-algorithm least_duration -r aR tests/ + - name: Run tests + run: | + pytest \ + -m "fuzzing" \ + --splits 60 \ + --group ${{ matrix.group }} \ + --splitting-algorithm least_duration \ + -r aR tests/ - name: Upload Coverage uses: codecov/codecov-action@v4 @@ -197,30 +217,3 @@ jobs: - name: Check slow tests all succeeded if: ${{ needs.fuzzing.result != 'success' }} run: exit 1 - - memory: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - # need to fetch unshallow so that setuptools_scm can infer the version - fetch-depth: 0 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - cache: "pip" - - - name: Install Tox - run: pip install tox - - - name: Run Tox - run: TOXENV=memory tox -r - - - name: Upload Coverage - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b943b5d31d..349feb21ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: mypy additional_dependencies: - "types-setuptools" - args: # settings from tox.ini + args: # settings from Makefile - --install-types - --non-interactive - --follow-imports=silent diff --git a/pyproject.toml b/pyproject.toml index af87f2b5cd..86dc93be1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,6 @@ exclude = ''' | \.git | \.hg | \.mypy_cache - | \.tox | \.venv | _build | buck-out diff --git a/setup.cfg b/setup.cfg index dd4a32a3ac..1d159fb17a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,6 @@ extend-ignore = E203 max-line-length = 100 exclude = venv* - .tox docs build per-file-ignores = diff --git a/setup.py b/setup.py index b0f7ef15f2..b69f478326 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ extras_require = { "test": [ "pytest>=8.0,<9.0", - "pytest-cov>=2.10,<3.0", + "pytest-cov>=4.1,<5.0", "pytest-instafail>=0.4,<1.0", "pytest-xdist>=2.5,<3.0", "pytest-split>=0.7.0,<1.0", @@ -17,7 +17,6 @@ "eth_abi>=4.0.0,<5.0.0", "py-evm>=0.7.0a1,<0.8", "web3==6.0.0", - "tox>=3.15,<4.0", "lark==1.1.9", "hypothesis[lark]>=6.0,<7.0", "eth-stdlib==0.2.7", diff --git a/tests/functional/codegen/test_selector_table_stability.py b/tests/functional/codegen/test_selector_table_stability.py index 27f82416d6..e3469f6915 100644 --- a/tests/functional/codegen/test_selector_table_stability.py +++ b/tests/functional/codegen/test_selector_table_stability.py @@ -13,7 +13,7 @@ def test_dense_jumptable_stability(): ) # test that the selector table data is stable across different runs - # (tox should provide different PYTHONHASHSEEDs). + # (xdist should provide different PYTHONHASHSEEDs). expected_asm = """{ DATA _sym_BUCKET_HEADERS b\'\\x0bB\' _sym_bucket_0 b\'\\n\' b\'+\\x8d\' _sym_bucket_1 b\'\\x0c\' b\'\\x00\\x85\' _sym_bucket_2 b\'\\x08\' } { DATA _sym_bucket_1 b\'\\xd8\\xee\\xa1\\xe8\' _sym_external 6 foo6()3639517672 b\'\\x05\' b\'\\xd2\\x9e\\xe0\\xf9\' _sym_external 0 foo0()3533627641 b\'\\x05\' b\'\\x05\\xf1\\xe0_\' _sym_external 2 foo2()99737695 b\'\\x05\' b\'\\x91\\t\\xb4{\' _sym_external 23 foo23()2433332347 b\'\\x05\' b\'np3\\x7f\' _sym_external 11 foo11()1852846975 b\'\\x05\' b\'&\\xf5\\x96\\xf9\' _sym_external 13 foo13()653629177 b\'\\x05\' b\'\\x04ga\\xeb\' _sym_external 14 foo14()73884139 b\'\\x05\' b\'\\x89\\x06\\xad\\xc6\' _sym_external 17 foo17()2298916294 b\'\\x05\' b\'\\xe4%\\xac\\xd1\' _sym_external 4 foo4()3827674321 b\'\\x05\' b\'yj\\x01\\xac\' _sym_external 7 foo7()2036990380 b\'\\x05\' b\'\\xf1\\xe6K\\xe5\' _sym_external 29 foo29()4058401765 b\'\\x05\' b\'\\xd2\\x89X\\xb8\' _sym_external 3 foo3()3532216504 b\'\\x05\' } { DATA _sym_bucket_2 b\'\\x06p\\xffj\' _sym_external 25 foo25()108068714 b\'\\x05\' b\'\\x964\\x99I\' _sym_external 24 foo24()2520029513 b\'\\x05\' b\'s\\x81\\xe7\\xc1\' _sym_external 10 foo10()1937893313 b\'\\x05\' b\'\\x85\\xad\\xc11\' _sym_external 28 foo28()2242756913 b\'\\x05\' b\'\\xfa"\\xb1\\xed\' _sym_external 5 foo5()4196577773 b\'\\x05\' b\'A\\xe7[\\x05\' _sym_external 22 foo22()1105681157 b\'\\x05\' b\'\\xd3\\x89U\\xe8\' _sym_external 1 foo1()3548993000 b\'\\x05\' b\'hL\\xf8\\xf3\' _sym_external 20 foo20()1749874931 b\'\\x05\' } { DATA _sym_bucket_0 b\'\\xee\\xd9\\x1d\\xe3\' _sym_external 9 foo9()4007206371 b\'\\x05\' b\'a\\xbc\\x1ch\' _sym_external 16 foo16()1639717992 b\'\\x05\' b\'\\xd3*\\xa7\\x0c\' _sym_external 21 foo21()3542787852 b\'\\x05\' b\'\\x18iG\\xd9\' _sym_external 19 foo19()409552857 b\'\\x05\' b\'\\n\\xf1\\xf9\\x7f\' _sym_external 18 foo18()183630207 b\'\\x05\' b\')\\xda\\xd7`\' _sym_external 27 foo27()702207840 b\'\\x05\' b\'2\\xf6\\xaa\\xda\' _sym_external 12 foo12()855026394 b\'\\x05\' b\'\\xbe\\xb5\\x05\\xf5\' _sym_external 15 foo15()3199534581 b\'\\x05\' b\'\\xfc\\xa7_\\xe6\' _sym_external 8 foo8()4238827494 b\'\\x05\' b\'\\x1b\\x12C8\' _sym_external 26 foo26()454181688 b\'\\x05\' } }""" # noqa: E501 assert expected_asm in output["asm"] diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 40b08f2d5c..0000000000 --- a/tox.ini +++ /dev/null @@ -1,29 +0,0 @@ -[tox] -envlist = - py{310,311} - docs - -[testenv:docs] -basepython=python3 -deps = - shibuya - sphinx - sphinx-copybutton -commands = - sphinx-build {posargs:-E} -b html docs dist/docs -n -q --color - -[testenv:fuzzing] -basepython = python3 -commands = - pytest -m fuzzing {posargs:tests/} -extras = - test -whitelist_externals = make - -[testenv:memory] -basepython = python3 -commands = - pytest --memorymock {posargs:tests/} -extras = - test -whitelist_externals = make From 58ecff597e7e5f51e4d84c09daf9153195e07487 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sun, 17 Mar 2024 17:58:53 -0400 Subject: [PATCH 3/3] chore[ci]: use `--dist worksteal` from latest `xdist` (#3869) should reduce test time, especially when there is a high degree of parallelism also increase the number of runners, as gh actions has increased limits lately --- .github/workflows/test.yml | 9 +++++++-- quicktest.sh | 2 +- setup.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c028fbd2cb..d1866ee18c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -137,6 +137,7 @@ jobs: - name: Run tests run: | pytest \ + --dist worksteal \ -m "not fuzzing" \ --optimize ${{ matrix.opt-mode }} \ --evm-version ${{ matrix.evm-version }} \ @@ -171,7 +172,10 @@ jobs: strategy: matrix: - group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60] + # note that every time this is updated, `--splits` needs to be + # updated below as well. + # python -c "print(list(range(1, 121)))" + group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120] steps: - uses: actions/checkout@v4 @@ -195,9 +199,10 @@ jobs: run: | pytest \ -m "fuzzing" \ - --splits 60 \ + --splits 120 \ --group ${{ matrix.group }} \ --splitting-algorithm least_duration \ + --dist worksteal \ -r aR tests/ - name: Upload Coverage diff --git a/quicktest.sh b/quicktest.sh index 8ecb322df9..cd2ee4d624 100755 --- a/quicktest.sh +++ b/quicktest.sh @@ -6,4 +6,4 @@ # run pytest but bail out on first error and suppress coverage. # useful for dev workflow -pytest -q --no-cov -s --instafail -x --disable-warnings "$@" +pytest --dist worksteal -q --no-cov -s --instafail -x --disable-warnings "$@" diff --git a/setup.py b/setup.py index b69f478326..becd73f7e3 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ "pytest>=8.0,<9.0", "pytest-cov>=4.1,<5.0", "pytest-instafail>=0.4,<1.0", - "pytest-xdist>=2.5,<3.0", + "pytest-xdist>=3.5,<4.0", "pytest-split>=0.7.0,<1.0", "eth-tester[py-evm]>=0.9.0b1,<0.10", "eth_abi>=4.0.0,<5.0.0",