Skip to content

Add tests for previously untested utility functions#1124

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/consolidate-update-testing-issues
Draft

Add tests for previously untested utility functions#1124
Copilot wants to merge 2 commits intomainfrom
copilot/consolidate-update-testing-issues

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

Several utility functions in pretext/utils.py lacked test coverage, and test_working_directory had an unresolved # TODO comment.

Changes

  • test_working_directory: Completed the TODO — asserts the working directory is restored after the context manager exits
  • test_format_docstring_as_help_str: Covers paragraph collapsing, double-newline preservation, whitespace stripping, and empty input
  • test_is_earlier_version: Covers major/minor/patch comparisons, equality, and the post-release dev build convention (e.g. 2.11.5 < 2.11.5.dev0)
  • test_hash_path: Asserts 10-char hex output, determinism, and uniqueness across distinct paths
  • test_xml_syntax_is_valid: Covers well-formed PreTeXt, wrong root tag, malformed XML, and IOError on missing file

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • runestone.academy
    • Triggering command: /usr/bin/python python scripts/fetch_core.py (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Consolidate and update testing issues</issue_title>
<issue_description>There are a few issues that relate to creating or improving tests. These should be consolidated or organized. Additions issues listing the other gaps in tests should be added.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…as_help_str, is_earlier_version, hash_path, xml_syntax_is_valid

Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com>
Copilot AI changed the title [WIP] Consolidate and update testing issues Add tests for previously untested utility functions Mar 20, 2026
Copilot AI requested a review from oscarlevin March 20, 2026 03:26
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.

Consolidate and update testing issues

2 participants