| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ on: | |||
| 12 | 12 | name: Periodic checks/tasks | |
| 13 | 13 | ||
| 14 | 14 | env: | |
| 15 | - CARGO_ARGS: --no-default-features --features stdlib,importlib,encodings,ssl-rustls,jit | ||
| 15 | + CARGO_ARGS: --no-default-features --features stdlib,importlib,stdio,encodings,ssl-rustls,jit,host_env | ||
| 16 | 16 | PYTHON_VERSION: "3.14.3" | |
| 17 | 17 | ||
| 18 | 18 | jobs: | |
@@ -35,7 +35,7 @@ jobs: | |||
| 35 | 35 | python-version: ${{ env.PYTHON_VERSION }} | |
| 36 | 36 | - run: sudo apt-get update && sudo apt-get -y install lcov | |
| 37 | 37 | - name: Run cargo-llvm-cov with Rust tests. | |
| 38 | - run: cargo llvm-cov --no-report --workspace --exclude rustpython_wasm --exclude rustpython-compiler-source --exclude rustpython-venvlauncher --verbose --no-default-features --features stdlib,importlib,encodings,ssl-rustls,jit | ||
| 38 | + run: cargo llvm-cov --no-report --workspace --exclude rustpython_wasm --exclude rustpython-compiler-source --exclude rustpython-venvlauncher --verbose --no-default-features --features stdlib,importlib,stdio,encodings,ssl-rustls,jit,host_env | ||
| 39 | 39 | - name: Run cargo-llvm-cov with Python snippets. | |
| 40 | 40 | run: python scripts/cargo-llvm-cov.py | |
| 41 | 41 | continue-on-error: true | |
@@ -48,7 +48,7 @@ jobs: | |||
| 48 | 48 | if: ${{ github.event_name != 'pull_request' }} | |
| 49 | 49 | uses: codecov/codecov-action@v5 | |
| 50 | 50 | with: | |
| 51 | - file: ./codecov.lcov | ||
| 51 | + files: ./codecov.lcov | ||
| 52 | 52 | ||
| 53 | 53 | testdata: | |
| 54 | 54 | name: Collect regression test data | |
@@ -170,12 +170,12 @@ jobs: | |||
| 170 | 170 | - name: restructure generated files | |
| 171 | 171 | run: | | |
| 172 | 172 | cd ./target/criterion/reports | |
| 173 | - find -type d -name cpython | xargs rm -rf | ||
| 174 | - find -type d -name rustpython | xargs rm -rf | ||
| 175 | - find -mindepth 2 -maxdepth 2 -name violin.svg | xargs rm -rf | ||
| 176 | - find -type f -not -name violin.svg | xargs rm -rf | ||
| 177 | - for file in $(find -type f -name violin.svg); do mv $file $(echo $file | sed -E "s_\./([^/]+)/([^/]+)/violin\.svg_./\1/\2.svg_"); done | ||
| 178 | - find -mindepth 2 -maxdepth 2 -type d | xargs rm -rf | ||
| 173 | + find . -type d -name cpython -print0 | xargs -0 rm -rf | ||
| 174 | + find . -type d -name rustpython -print0 | xargs -0 rm -rf | ||
| 175 | + find . -mindepth 2 -maxdepth 2 -name violin.svg -print0 | xargs -0 rm -rf | ||
| 176 | + find . -type f -not -name violin.svg -print0 | xargs -0 rm -rf | ||
| 177 | + find . -type f -name violin.svg -exec sh -c 'for file; do mv "$file" "$(echo "$file" | sed -E "s_\./([^/]+)/([^/]+)/violin\.svg_./\1/\2.svg_")"; done' _ {} + | ||
| 178 | + find . -mindepth 2 -maxdepth 2 -type d -print0 | xargs -0 rm -rf | ||
| 179 | 179 | cd .. | |
| 180 | 180 | mv reports/* . | |
| 181 | 181 | rmdir reports | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,6 +38,16 @@ | |||
| 38 | 38 | from unittest.runner import registerResult, result | |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | + def _get_method_dict(test): | ||
| 42 | + """Get the __dict__ of the underlying function for a test method. | ||
| 43 | + | ||
| 44 | + Works for both bound methods (__func__.__dict__) and plain functions. | ||
| 45 | + """ | ||
| 46 | + method = getattr(test, test._testMethodName) | ||
| 47 | + func = getattr(method, "__func__", method) | ||
| 48 | + return func.__dict__ | ||
| 49 | + | ||
| 50 | + | ||
| 41 | 51 | class TablePrinter(object): | |
| 42 | 52 | # Modified from https://github.com/agramian/table-printer, same license as above | |
| 43 | 53 | "Print a list of dicts as a table" | |
@@ -325,9 +335,7 @@ def startTest(self, test): | |||
| 325 | 335 | self.stream.writeln("TEST SUITE: %s" % self.suite) | |
| 326 | 336 | self.stream.writeln("Description: %s" % self.getSuiteDescription(test)) | |
| 327 | 337 | try: | |
| 328 | - name_override = getattr(test, test._testMethodName).__func__.__dict__[ | ||
| 329 | - "test_case_name" | ||
| 330 | - ] | ||
| 338 | + name_override = _get_method_dict(test)["test_case_name"] | ||
| 331 | 339 | except: | |
| 332 | 340 | name_override = None | |
| 333 | 341 | self.case = name_override if name_override else self.case | |
@@ -345,7 +353,11 @@ def startTest(self, test): | |||
| 345 | 353 | self.results["suites"][self.suite_number] = { | |
| 346 | 354 | "name": self.suite, | |
| 347 | 355 | "class": test.__class__.__name__, | |
| 348 | - "module": re.compile(".* \((.*)\)").match(str(test)).group(1), | ||
| 356 | + "module": ( | ||
| 357 | + m.group(1) | ||
| 358 | + if (m := re.compile(r".* \((.*)\)").match(str(test))) | ||
| 359 | + else str(test) | ||
| 360 | + ), | ||
| 349 | 361 | "description": self.getSuiteDescription(test), | |
| 350 | 362 | "cases": {}, | |
| 351 | 363 | "used_case_names": {}, | |
@@ -380,34 +392,22 @@ def startTest(self, test): | |||
| 380 | 392 | if "test_type" in getattr( | |
| 381 | 393 | test, test._testMethodName | |
| 382 | 394 | ).__func__.__dict__ and set([s.lower() for s in self.test_types]) == set( | |
| 383 | - [ | ||
| 384 | - s.lower() | ||
| 385 | - for s in getattr(test, test._testMethodName).__func__.__dict__[ | ||
| 386 | - "test_type" | ||
| 387 | - ] | ||
| 388 | - ] | ||
| 395 | + [s.lower() for s in _get_method_dict(test)["test_type"]] | ||
| 389 | 396 | ): | |
| 390 | 397 | pass | |
| 391 | 398 | else: | |
| 392 | - getattr(test, test._testMethodName).__func__.__dict__[ | ||
| 393 | - "__unittest_skip_why__" | ||
| 394 | - ] = 'Test run specified to only run tests of type "%s"' % ",".join( | ||
| 395 | - self.test_types | ||
| 399 | + _get_method_dict(test)["__unittest_skip_why__"] = ( | ||
| 400 | + 'Test run specified to only run tests of type "%s"' | ||
| 401 | + % ",".join(self.test_types) | ||
| 396 | 402 | ) | |
| 397 | - getattr(test, test._testMethodName).__func__.__dict__[ | ||
| 398 | - "__unittest_skip__" | ||
| 399 | - ] = True | ||
| 400 | - if "skip_device" in getattr(test, test._testMethodName).__func__.__dict__: | ||
| 401 | - for device in getattr(test, test._testMethodName).__func__.__dict__[ | ||
| 402 | - "skip_device" | ||
| 403 | - ]: | ||
| 403 | + _get_method_dict(test)["__unittest_skip__"] = True | ||
| 404 | + if "skip_device" in _get_method_dict(test): | ||
| 405 | + for device in _get_method_dict(test)["skip_device"]: | ||
| 404 | 406 | if self.config and device.lower() in self.config["device_name"].lower(): | |
| 405 | - getattr(test, test._testMethodName).__func__.__dict__[ | ||
| 406 | - "__unittest_skip_why__" | ||
| 407 | - ] = "Test is marked to be skipped on %s" % device | ||
| 408 | - getattr(test, test._testMethodName).__func__.__dict__[ | ||
| 409 | - "__unittest_skip__" | ||
| 410 | - ] = True | ||
| 407 | + _get_method_dict(test)["__unittest_skip_why__"] = ( | ||
| 408 | + "Test is marked to be skipped on %s" % device | ||
| 409 | + ) | ||
| 410 | + _get_method_dict(test)["__unittest_skip__"] = True | ||
| 411 | 411 | break | |
| 412 | 412 | ||
| 413 | 413 | def stopTest(self, test): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments