Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cron-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion benches/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
})
Expand Down
4 changes: 2 additions & 2 deletions benches/microbenchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -138,7 +138,7 @@ fn bench_rustpy_code(group: &mut BenchmarkGroup<WallTime>, 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());
Expand Down
16 changes: 14 additions & 2 deletions extra_tests/jsontests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
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):
Expand Down
2 changes: 1 addition & 1 deletion whats_left.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down