From 60159b26327fe33005f58bb7baded922321e9542 Mon Sep 17 00:00:00 2001 From: Noa Date: Thu, 18 Aug 2022 20:32:21 -0500 Subject: [PATCH 1/4] Fix jsontests.py interaction with module-level SkipTest --- extra_tests/jsontests.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/extra_tests/jsontests.py b/extra_tests/jsontests.py index 6777299b6..93cb4b7db 100644 --- a/extra_tests/jsontests.py +++ b/extra_tests/jsontests.py @@ -3,9 +3,21 @@ from custom_text_test_runner import CustomTextTestRunner as Runner from test.libregrtest.runtest import findtests import os -testnames = ('test.' + name for name in findtests()) -suite = unittest.defaultTestLoader.loadTestsFromNames(testnames) +def loadTestsOrSkip(loader, name): + try: + return loader.loadTestsFromName(name) + except unittest.SkipTest as exc: + # from _make_skipped_test from unittest/loader.py + @unittest.skip(str(exc)) + def testSkipped(self): + pass + attrs = {name: testSkipped} + TestClass = type("ModuleSkipped", (unittest.TestCase,), attrs) + return loader.suiteClass((TestClass(name),)) + +loader = unittest.defaultTestLoader +suite = loader.suiteClass([loadTestsOrSkip(loader, 'test.' + name) for name in findtests()]) resultsfile = os.path.join(os.path.dirname(__file__), "cpython_tests_results.json") if os.path.exists(resultsfile): From e0b03c85de3e22f191568513b0f7702aca1c62bf Mon Sep 17 00:00:00 2001 From: Noa Date: Thu, 18 Aug 2022 20:42:13 -0500 Subject: [PATCH 2/4] Don't abort codecov data upload when regrtests fail --- .github/workflows/cron-ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cron-ci.yaml b/.github/workflows/cron-ci.yaml index 2530373cd..1bd8389ba 100644 --- a/.github/workflows/cron-ci.yaml +++ b/.github/workflows/cron-ci.yaml @@ -29,8 +29,10 @@ jobs: - name: run snippets run: LLVM_PROFILE_FILE="$PWD/snippet-%p.profraw" pytest -v working-directory: ./extra_tests + continue-on-error: true - name: run cpython tests run: LLVM_PROFILE_FILE="$PWD/regrtest.profraw" target/release/rustpython -m test -v + continue-on-error: true - name: prepare code coverage data run: | rusttool() { From 19b5b08aee5004291bd28cc217dd2533134968a4 Mon Sep 17 00:00:00 2001 From: Noa Date: Thu, 18 Aug 2022 20:43:20 -0500 Subject: [PATCH 3/4] Use /usr/bin/env -S --- whats_left.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whats_left.py b/whats_left.py index 7ea58c7ec..ccf55927e 100755 --- a/whats_left.py +++ b/whats_left.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 -I +#!/usr/bin/env -S python3 -I # This script generates Lib/snippets/whats_left_data.py with these variables defined: # expected_methods - a dictionary mapping builtin objects to their methods From 33e848e32ebf18451612d02950db670571ff6cdd Mon Sep 17 00:00:00 2001 From: Noa Date: Thu, 18 Aug 2022 20:52:11 -0500 Subject: [PATCH 4/4] Fix benches --- benches/execution.rs | 2 +- benches/microbenchmarks.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benches/execution.rs b/benches/execution.rs index b95941c2b..d286365b8 100644 --- a/benches/execution.rs +++ b/benches/execution.rs @@ -116,7 +116,7 @@ pub fn criterion_benchmark(c: &mut Criterion) { .map(|entry| { let path = entry.unwrap().path(); ( - path.file_name().unwrap().to_owned().unwrap().to_owned(), + path.file_name().unwrap().to_str().unwrap().to_owned(), std::fs::read_to_string(path).unwrap(), ) }) diff --git a/benches/microbenchmarks.rs b/benches/microbenchmarks.rs index b43e8ef2c..f1adbc911 100644 --- a/benches/microbenchmarks.rs +++ b/benches/microbenchmarks.rs @@ -3,7 +3,7 @@ use criterion::{ Criterion, Throughput, }; use rustpython_compiler::Mode; -use rustpython_vm::{common::ascii, AsObject, Interpreter, PyResult, Settings}; +use rustpython_vm::{AsObject, Interpreter, PyResult, Settings}; use std::{ ffi, fs, io, path::{Path, PathBuf}, @@ -138,7 +138,7 @@ fn bench_rustpy_code(group: &mut BenchmarkGroup, bench: &MicroBenchmar scope .locals .as_object() - .set_item(vm.new_pyobj(ascii!("ITERATIONS")), vm.new_pyobj(idx), vm) + .set_item("ITERATIONS", vm.new_pyobj(idx), vm) .expect("Error adding ITERATIONS local variable"); } let setup_result = vm.run_code_obj(setup_code.clone(), scope.clone());