From 51a14c989d9efa369c96d7b231e409a7cd1a31b6 Mon Sep 17 00:00:00 2001 From: Noorhteen Raja NJ Date: Thu, 16 May 2024 15:43:57 +0530 Subject: [PATCH] chore: use stable 3.12 for CI jobs (#5307) --- .github/workflows/test.yml | 13 +++++++------ .gitignore | 3 +++ tests/completers/test_python.py | 2 +- tests/procs/test_specs.py | 2 +- tests/test_integrations.py | 2 +- xonsh/ast.py | 2 -- xonsh/parsers/base.py | 14 +------------- xonsh/pretty.py | 19 ++++--------------- 8 files changed, 18 insertions(+), 39 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51b755d79..c489104bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,7 @@ jobs: runs-on: ${{ matrix.os }} env: UV_CACHE_DIR: .cache/uv + DEFAULT_PYTHON_VERSION: 3.12 strategy: fail-fast: false matrix: @@ -34,10 +35,10 @@ jobs: - macOS-latest - windows-latest python-version: - - "3.9" - "3.10" - "3.11" - - "3.12-dev" + - "3.12" +# - "3.13-dev" name: Test Python ${{ matrix.python-version }} ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -63,20 +64,20 @@ jobs: if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tmate_debug_enabled }} timeout-minutes: 15 - name: Run QA Checks - if: ${{ startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python-version, '3.11') }} + if: ${{ startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python-version, env.DEFAULT_PYTHON_VERSION) }} run: python -m xonsh run-tests.xsh validate-news-items - name: Run tests - if: ${{ !startsWith(matrix.python-version, '3.11') }} + if: ${{ !startsWith(matrix.python-version, env.DEFAULT_PYTHON_VERSION) }} run: | python -m pip install . --no-deps python -m xonsh run-tests.xsh test -- --timeout=240 - name: Run tests with coverage - if: ${{ startsWith(matrix.python-version, '3.11') }} + if: ${{ startsWith(matrix.python-version, env.DEFAULT_PYTHON_VERSION) }} run: | python -m pip install -e . --no-deps python -m xonsh run-tests.xsh test --report-coverage -- --timeout=240 - name: Upload coverage to Codecov - if: ${{ startsWith(matrix.python-version, '3.11') }} + if: ${{ startsWith(matrix.python-version, env.DEFAULT_PYTHON_VERSION) }} uses: codecov/codecov-action@v4 with: verbose: true diff --git a/.gitignore b/.gitignore index 0795c12e1..f2c735977 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,6 @@ __pypackages__ # one can use pip or pdm during development pdm.lock + +# asv benchmarks +.asv/ diff --git a/tests/completers/test_python.py b/tests/completers/test_python.py index 265c3fcb0..8edd0d3c5 100644 --- a/tests/completers/test_python.py +++ b/tests/completers/test_python.py @@ -104,7 +104,7 @@ def test_complete_python_ctx(): ("from pathlib import PosixPath PurePa", {"PurePath"}), ], ) -@pytest.mark.flaky(reruns=5, reruns_delay=2) +@pytest.mark.flaky(reruns=2, reruns_delay=2) def test_complete_import(command, exp, completer_obj): result = complete_import(completer_obj.parse(command)) if isinstance(result, tuple): diff --git a/tests/procs/test_specs.py b/tests/procs/test_specs.py index a02bf88c6..7721a20c8 100644 --- a/tests/procs/test_specs.py +++ b/tests/procs/test_specs.py @@ -72,7 +72,7 @@ def test_cmds_to_specs_capture_stdout_not_stderr(thread_subprocs, xonsh_session) @pytest.mark.parametrize( "thread_subprocs, capture_always", list(itertools.product((True, False), repeat=2)) ) -@pytest.mark.flaky(reruns=5, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=2) def test_capture_always( capfd, thread_subprocs, capture_always, alias_type, pipe, monkeypatch, xonsh_session ): diff --git a/tests/test_integrations.py b/tests/test_integrations.py index 9386deefd..a0d1918ff 100644 --- a/tests/test_integrations.py +++ b/tests/test_integrations.py @@ -659,7 +659,7 @@ if not ON_WINDOWS: @skip_if_no_xonsh @pytest.mark.parametrize("case", ALL_PLATFORMS) -@pytest.mark.flaky(reruns=5, reruns_delay=2) +@pytest.mark.flaky(reruns=3, reruns_delay=2) def test_script(case): script, exp_out, exp_rtn = case out, err, rtn = run_xonsh(script) diff --git a/xonsh/ast.py b/xonsh/ast.py index 52c0ba4a2..22fefc161 100644 --- a/xonsh/ast.py +++ b/xonsh/ast.py @@ -312,8 +312,6 @@ def xonsh_call(name, args, lineno=None, col=None): func=load_attribute_chain(name, lineno=lineno, col=col), args=args, keywords=[], - starargs=None, - kwargs=None, lineno=lineno, col_offset=col, ) diff --git a/xonsh/parsers/base.py b/xonsh/parsers/base.py index 76c2ba4f1..a150a0c2f 100644 --- a/xonsh/parsers/base.py +++ b/xonsh/parsers/base.py @@ -83,8 +83,6 @@ def call_split_lines(x, lineno=None, col=None): ), args=[], keywords=[], - starargs=None, - kwargs=None, lineno=lineno, col_offset=col, ) @@ -104,8 +102,6 @@ def ensure_list_from_str_or_list(x, lineno=None, col=None): ), args=[x, ast.Name(id="str", ctx=ast.Load(), lineno=lineno, col_offset=col)], keywords=[], - starargs=None, - kwargs=None, lineno=lineno, col_offset=col, ), @@ -820,8 +816,6 @@ class BaseParser: func=name, args=[], keywords=[], - starargs=None, - kwargs=None, lineno=lineno, col_offset=col, ) @@ -2688,7 +2682,7 @@ class BaseParser: def p_trailer_lparen(self, p): """trailer : LPAREN arglist_opt RPAREN""" - p[0] = [p[2] or dict(args=[], keywords=[], starargs=None, kwargs=None)] + p[0] = [p[2] or dict(args=[], keywords=[])] def p_trailer_bang_lparen(self, p): """ @@ -3027,8 +3021,6 @@ class BaseParser: name=p[2], bases=b, keywords=kw, - starargs=None, - kwargs=None, body=p[5], decorator_list=[], lineno=p1.lineno, @@ -3171,8 +3163,6 @@ class BaseParser: ast.const_str(s="", lineno=lineno, col_offset=col), ], keywords=[], - starargs=None, - kwargs=None, lineno=lineno, col_offset=col, ) @@ -3377,8 +3367,6 @@ class BaseParser: func=func, args=[p[2], ast.const_str(s="", lineno=lineno, col_offset=col)], keywords=[], - starargs=None, - kwargs=None, lineno=lineno, col_offset=col, ) diff --git a/xonsh/pretty.py b/xonsh/pretty.py index f7ec0d2b3..3406d4c76 100644 --- a/xonsh/pretty.py +++ b/xonsh/pretty.py @@ -677,7 +677,6 @@ def _re_pattern_pprint(obj, p, cycle): p.breakable() done_one = False for flag in ( - "TEMPLATE", "IGNORECASE", "LOCALE", "MULTILINE", @@ -769,13 +768,16 @@ def _type_pprinters(): set: _set_pprinter_factory("{", "}", set), frozenset: _set_pprinter_factory("frozenset({", "})", frozenset), super: _super_pprint, - type(re.compile("")): _re_pattern_pprint, + re.Pattern: _re_pattern_pprint, type: _type_pprint, types.FunctionType: _function_pprint, types.BuiltinFunctionType: _function_pprint, types.MethodType: _repr_pprint, datetime.datetime: _repr_pprint, datetime.timedelta: _repr_pprint, + slice: _repr_pprint, + range: _repr_pprint, + bytes: _repr_pprint, } #: the exception base try: @@ -783,19 +785,6 @@ def _type_pprinters(): except NameError: _exception_base = Exception tp[_exception_base] = _exception_pprint - try: - tp[types.DictProxyType] = _dict_pprinter_factory("") - tp[types.ClassType] = _type_pprint - tp[types.SliceType] = _repr_pprint - except AttributeError: # Python 3 - tp[slice] = _repr_pprint - try: - tp[xrange] = _repr_pprint - tp[long] = _repr_pprint - tp[unicode] = _repr_pprint - except NameError: - tp[range] = _repr_pprint - tp[bytes] = _repr_pprint return tp