Reject raw_data_location=None with a clear UserInputError#80
Merged
Conversation
Cherry-picked source change from #67 (commit 7e71e73). The companion tests/test_00_test_setup.py from the original commit is dropped — it asserted that defaults.raw_data_cache is set, which PR #72 made obsolete when the suite switched to fixture-scoped temp directories via nemosis_fixture. Without this check, passing raw_data_location=None falls through to os.path.isdir(None) and raises TypeError from inside the stdlib, with a message that doesn't mention the parameter. UserInputError is the contract for caller-input mistakes, and the message now names the parameter. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Apply the same UserInputError("...is None") guard to static_table that
the previous commit added to dynamic_data_compiler and cache_compiler.
The original cherry-picked work (PR #67) didn't cover static_table, but
it has the same `_os.path.isdir(raw_data_location)` line and the same
TypeError-from-stdlib UX flaw on None input.
Add three regression tests to tests/test_errors.py — one per public
entrypoint — locking in the contract that None raises UserInputError
with a message naming the parameter. The tests don't take the
nemosis_fixture parameter because the None check fires before any
disk or network access.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvages the one source-side improvement from #67's test-triage bundle that survived PR #72 — explicit
Nonecheck onraw_data_locationin all three public entrypoints. Today, passingNonefalls through toos.path.isdir(None)and raisesTypeErrorfrom the stdlib, with a message that doesn't mention the parameter. Now it raisesUserInputError(the library's contract for caller-input mistakes) with a message that names the parameter.Two commits:
Reject raw_data_location=None with a clear UserInputError(author: @mdavis-xyz) — cherry-picked from Skip/Speed up tests, resolve most open issues #67 commit7e71e73, source change only. Adds the check todynamic_data_compilerandcache_compiler. The companiontests/test_00_test_setup.pyfrom the original commit is dropped: it asserteddefaults.raw_data_cacheis set via theNEMOSIS_TEST_CACHEenv var, which Port test suite to offline fixture-based architecture #72 obsoleted by moving to fixture-scoped temp dirs vianemosis_fixture.Extend None-check to static_table and add regression tests(author: me) — applies the same check tostatic_table(the original commit didn't, but it has the same_os.path.isdirline and the same UX flaw), and adds one regression test per entrypoint totests/test_errors.py.Context — what else is left from PR #67's test triage
Audited all six test commits from #67 against post-#72 master:
dd01b63skip cache-purging tests (#16)tests/test_format_options.pydeleted by #72e3dbef5skip FCAS_4_SECOND tests (#64)tests/test_data_fetch_methods.pydeleted; no live-AEMO FCAS tests left397bdf8un-hardcode cache pathtests/test_errors_and_warnings.pydeleted; newtest_errors.pyuses fixture pathfea56a0skip long processing_info_maps teststest_processing_info_maps.pyrewritten by #72, now offline + fast7e71e73cache-path robustness238fd35typo fix intest_00_test_setup.pyTest plan
uv run pytest tests/test_errors.py— 16/16 pass (13 pre-existing + 3 new)