Skip to content

Commit d4a9301

Browse files
authored
Merge pull request RustPython#4104 from RustPython/fix-jsontests
Fix jsontests.py interaction with module-level SkipTest
2 parents 5c58b32 + 33e848e commit d4a9301

5 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/cron-ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ jobs:
2929
- name: run snippets
3030
run: LLVM_PROFILE_FILE="$PWD/snippet-%p.profraw" pytest -v
3131
working-directory: ./extra_tests
32+
continue-on-error: true
3233
- name: run cpython tests
3334
run: LLVM_PROFILE_FILE="$PWD/regrtest.profraw" target/release/rustpython -m test -v
35+
continue-on-error: true
3436
- name: prepare code coverage data
3537
run: |
3638
rusttool() {

benches/execution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
116116
.map(|entry| {
117117
let path = entry.unwrap().path();
118118
(
119-
path.file_name().unwrap().to_owned().unwrap().to_owned(),
119+
path.file_name().unwrap().to_str().unwrap().to_owned(),
120120
std::fs::read_to_string(path).unwrap(),
121121
)
122122
})

benches/microbenchmarks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use criterion::{
33
Criterion, Throughput,
44
};
55
use rustpython_compiler::Mode;
6-
use rustpython_vm::{common::ascii, AsObject, Interpreter, PyResult, Settings};
6+
use rustpython_vm::{AsObject, Interpreter, PyResult, Settings};
77
use std::{
88
ffi, fs, io,
99
path::{Path, PathBuf},
@@ -138,7 +138,7 @@ fn bench_rustpy_code(group: &mut BenchmarkGroup<WallTime>, bench: &MicroBenchmar
138138
scope
139139
.locals
140140
.as_object()
141-
.set_item(vm.new_pyobj(ascii!("ITERATIONS")), vm.new_pyobj(idx), vm)
141+
.set_item("ITERATIONS", vm.new_pyobj(idx), vm)
142142
.expect("Error adding ITERATIONS local variable");
143143
}
144144
let setup_result = vm.run_code_obj(setup_code.clone(), scope.clone());

extra_tests/jsontests.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@
33
from test.libregrtest.runtest import findtests
44
import os
55

6-
testnames = ('test.' + name for name in findtests())
76

8-
suite = unittest.defaultTestLoader.loadTestsFromNames(testnames)
7+
def loadTestsOrSkip(loader, name):
8+
try:
9+
return loader.loadTestsFromName(name)
10+
except unittest.SkipTest as exc:
11+
# from _make_skipped_test from unittest/loader.py
12+
@unittest.skip(str(exc))
13+
def testSkipped(self):
14+
pass
15+
attrs = {name: testSkipped}
16+
TestClass = type("ModuleSkipped", (unittest.TestCase,), attrs)
17+
return loader.suiteClass((TestClass(name),))
18+
19+
loader = unittest.defaultTestLoader
20+
suite = loader.suiteClass([loadTestsOrSkip(loader, 'test.' + name) for name in findtests()])
921

1022
resultsfile = os.path.join(os.path.dirname(__file__), "cpython_tests_results.json")
1123
if os.path.exists(resultsfile):

whats_left.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3 -I
1+
#!/usr/bin/env -S python3 -I
22

33
# This script generates Lib/snippets/whats_left_data.py with these variables defined:
44
# expected_methods - a dictionary mapping builtin objects to their methods

0 commit comments

Comments
 (0)