Skip to content

tests: enable test_importlib subpackage (#491)#551

Merged
ppenna merged 1 commit into
nanvix/v3.12.3from
tests/test-importlib-subpackage
Apr 29, 2026
Merged

tests: enable test_importlib subpackage (#491)#551
ppenna merged 1 commit into
nanvix/v3.12.3from
tests/test-importlib-subpackage

Conversation

@ada-x64
Copy link
Copy Markdown

@ada-x64 ada-x64 commented Apr 28, 2026

Summary

Changes

Enables the full test_importlib sub-package (45 test files across 9 sub-areas: source, frozen, extension, resources, import_, builtin, namespace_pkgs, partial, data) on Nanvix. Adds test_importlib to NANVIX_TEST_LIST with @unittest.skipIf annotations for the failure classes that surface on FAT VFS, linuxd, and the static-link build.

Verified GREEN on both modes:

Mode Result
standalone 91/91 modules / 23/23 batches PASS
single-process 94/94 modules / 24/24 batches PASS

Also: .nanvix/run-tests.py direct (hosted) branch now passes -B, symmetric with the standalone branch which already does so. Without -B, importing any source whose mtime is newer than its compiled pyc hangs the guest kernel via NSKIP055 (linuxd os.replace hang); this is mandatory infrastructure for hosted, not a test-specific workaround.

New NSKIPS

NSKIP code Description
NSKIP054 Nanvix is built static-only; no dynamic extension modules (.so) available
NSKIP055 linuxd rename()/replace() hangs the kernel on hosted Nanvix

NSKIP055 is the hosted analog of NSKIP021: same user-visible symptom (os.rename/os.replace hangs the kernel), but a distinct bug in a different VFS layer (linuxd RPC vs rust-fatfs). Independently fixable, so it gets its own ID. Every test that exercises rename now stacks both decorators (NSKIP021 fires on standalone, NSKIP055 on hosted).

NSKIP054 covers the static-link build: importlib.machinery.EXTENSION_SUFFIXES is non-empty but no .so file exists on sys.path, so util.EXTENSIONS.filename stays None and the upstream Requires dynamic loading support. skip guard does not fire. Affects every test in extension/test_loader.py and extension/test_finder.py.


Refs: NSKIP008, NSKIP012, NSKIP016, NSKIP021, NSKIP026, NSKIP043, #371, #490
Closes #491.

Copilot AI review requested due to automatic review settings April 28, 2026 16:08
@ada-x64 ada-x64 force-pushed the tests/test-importlib-subpackage branch 2 times, most recently from 39b009d to 9a3cb94 Compare April 28, 2026 16:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables CPython’s test_importlib subpackage in the Nanvix test suite by adding it to the Nanvix test list and applying Nanvix-specific skips for known kernel/VFS limitations (standalone FAT VFS, hosted linuxd passthrough, and static-only builds). It also adjusts the Nanvix test harness to avoid hosted hangs by running the guest Python with -B in direct mode.

Changes:

  • Add test_importlib to the Nanvix test module allowlist and enable running its sub-areas with targeted NSKIP-based skips.
  • Introduce/extend Nanvix platform discrimination in test support and update multiple tests to skip known-failing/hanging cases.
  • Update .nanvix/run-tests.py direct-mode invocation to pass -B to prevent hosted kernel hangs during bytecode writes.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/workflows/nanvix-ci.yml CI workflow adjustments related to updated Nanvix testing.
.nanvix/build.py Build tooling tweaks supporting updated test enablement.
.nanvix/config.py Adds test_importlib to NANVIX_TEST_LIST.
.nanvix/nanvix.toml Pins/updates Nanvix tooling configuration.
.nanvix/package.py Packaging/tooling updates for the new test surface.
.nanvix/run-regrtest.py Removes/adjusts regrtest runner logic for new harness behavior.
.nanvix/run-tests.py Passes -B in direct mode; documents hosted rename/replace hang.
.nanvix/test.py Expands test orchestration/filters to include test_importlib.
.nanvix/z.py Refactors/updates Nanvix zutil script behaviors for new flows.
Lib/test/support/init.py Adds Nanvix topology helpers and hosted cleanup workarounds.
Lib/test/support/os_helper.py Nanvix-specific filesystem/test cleanup accommodations.
Lib/test/support/socket_helper.py Updates socket helper behavior for Nanvix constraints.
Lib/test/test_array.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_ast.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_builtin.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_code.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_collections.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_contextlib.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_coroutines.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_decimal.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_defaultdict.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_deque.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_dict.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_exception_group.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_exceptions.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_fractions.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_functools.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_importlib/extension/test_finder.py Skips extension-module tests on static-only Nanvix.
Lib/test/test_importlib/extension/test_loader.py Skips extension-module tests on static-only Nanvix.
Lib/test/test_importlib/import_/test_path.py Adds Nanvix skips for known cleanup failures.
Lib/test/test_importlib/resources/test_path.py Skips hosted Nanvix due to rmtree/rmdir cleanup issues.
Lib/test/test_importlib/resources/test_resource.py Adds hosted Nanvix skips for cleanup-related failures.
Lib/test/test_importlib/source/test_case_sensitivity.py Skips standalone Nanvix for FAT case/8.3 behavior.
Lib/test/test_importlib/source/test_file_loader.py Skips Nanvix modes affected by rename/replace hangs.
Lib/test/test_importlib/source/test_finder.py Skips Nanvix modes affected by rename/replace hangs.
Lib/test/test_importlib/source/test_source_encoding.py Skips standalone Nanvix due to rename hang surface.
Lib/test/test_importlib/test_api.py Adds Nanvix skips around reload/rename behaviors.
Lib/test/test_importlib/test_lazy.py Skips threaded race test on Nanvix thread-limit constraints.
Lib/test/test_importlib/test_locks.py Skips module on Nanvix due to thread-limit constraints.
Lib/test/test_importlib/test_main.py Adds hosted Nanvix skips for cleanup failures; targeted skips.
Lib/test/test_importlib/test_metadata_api.py Adds hosted/standalone Nanvix skips for known VFS errnos.
Lib/test/test_importlib/test_namespace_pkgs.py Adds hosted Nanvix skip for cleanup failures.
Lib/test/test_importlib/test_pkg_import.py Adds hosted/rename-hang related skips for Nanvix.
Lib/test/test_importlib/test_threaded_import.py Skips module on Nanvix due to thread-limit constraints.
Lib/test/test_importlib/test_util.py Adds Nanvix skips for rename/replace hang cases.
Lib/test/test_int.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_iter.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_itertools.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_list.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_math.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_operator.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_ordered_dict.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_queue.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_random.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_range.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_reprlib.py Adds/updates Nanvix skip coverage for cleanup limitations.
Lib/test/test_set.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_slice.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_statistics.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_super.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_tuple.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_types.py Adds Nanvix skips/adjustments for newly enabled coverage.
Lib/test/test_weakref.py Adds Nanvix skips/adjustments for newly enabled coverage.
z.ps1 Syncs bootstrap script with updated zutils template/version.
z.sh Syncs bootstrap script with updated zutils template/version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .nanvix/run-tests.py
Adds test_importlib to NANVIX_TEST_LIST and applies NSKIP guards for
the failure classes that surface on Nanvix.  Verified GREEN on both
modes:

  standalone:      91/91 modules / 23/23 batches PASS
  single-process:  94/94 modules / 24/24 batches PASS

NSKIPs applied (each at every site that triggers the underlying bug):

- NSKIP008 (#476): tempfile names garbled
  test_main.test_unicode_dir_on_sys_path

- NSKIP012 (#480): rmtree/rmdir cleanup failures
  test_main: 8 classes; test_metadata_api: APITests, LegacyDots,
  OffSysPathTests; test_pkg_import.TestImport;
  test_namespace_pkgs.test_invalidate_caches; resources/test_path
  (module); resources/test_resource: 2 methods;
  import_/test_path.test_deleted_cwd

- NSKIP016 (#484): exceeds Nanvix thread limit
  test_locks (module), test_threaded_import (module),
  test_lazy.test_module_load_race

- NSKIP021 (#501): FAT VFS rename() hangs the kernel  [standalone]
  source/test_file_loader, source/test_finder,
  source/test_source_encoding (modules);
  test_api.test_reload_{location_changed,namespace_changed,submodule};
  test_pkg_import.test_package_import__semantics;
  test_util.FindSpecTests: 4 methods

- NSKIP026 (#506): FAT VFS returns wrong errno for path-edge cases
  test_metadata_api.APITests: 8 methods

- NSKIP043 (#523): FAT VFS case-insensitivity / 8.3 short-name retention
  source/test_case_sensitivity (module)

- NSKIP054 (NEW): static-only build, no dynamic extension modules
  extension/test_loader, extension/test_finder (modules)

- NSKIP055 (NEW): linuxd rename()/replace() hangs the kernel on hosted
  Hosted analog of NSKIP021; paired at every NSKIP021 site since the
  user-visible symptom is identical but the bugs are independently
  fixable (different VFS layers).

Also: .nanvix/run-tests.py direct (hosted) branch now passes -B,
symmetric with the standalone branch which already does so.  Without
-B, importing any source whose mtime is newer than its compiled pyc
hangs the guest kernel (NSKIP055).  Mandatory infrastructure for
hosted, not a test-specific workaround.

Closes #491.
@ada-x64 ada-x64 force-pushed the tests/test-importlib-subpackage branch from 9a3cb94 to 4fb4fe7 Compare April 29, 2026 14:45
@ppenna ppenna merged commit 2113da0 into nanvix/v3.12.3 Apr 29, 2026
12 checks passed
@ppenna ppenna deleted the tests/test-importlib-subpackage branch April 29, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable test_importlib sub-package on Nanvix

3 participants