Repository navigation
Conversation
ModelSEED#173 added this file without the `# -*- coding: utf-8 -*-` line that the `fix-encoding-pragma` hook in .pre-commit-config.yaml requires, so the pre-commit job has failed on `dev` since 67e8284 (and failed on ModelSEED#173 itself). Every other test module already carries the pragma. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`types: [python]` on this hook REPLACES the manifest's `types: [text, executable]` rather than narrowing it, so the executable filter is dropped and the hook is handed every .py file in the tree. pre-commit-hooks v4.3.0 then consults file modes only when `git config core.fileMode` is literally `false`; otherwise its whole check is "does this file start with #!". On a normal clone (fileMode true, the default) that flags every module that is not a script. Measured on a fresh worktree of dev 67e8284: 97 files "marked executable but has no (or invalid) shebang!" None of them is executable. CI does not see this only because .github/workflows/pre-commit.yml runs `git config core.filemode false` first, which routes the hook into its `git ls-files --stage` branch. Run locally, or as an installed git hook, it fails on every commit. Dropping the override restores the manifest's filter: only executable text files are checked. After this change the hook passes with fileMode true and with fileMode false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`find_packages(exclude=("docs"))` passes a STRING, not a tuple, so setuptools
iterates its characters and the exclude matches nothing. `pip install
modelseedpy` therefore installs two extra top-level packages into
site-packages,
tests, tests.test_data
squatting the generic name `tests` in every environment that installs this
library, where it can shadow a consumer's own test package.
The exclude now names docs and tests and their subpackages. No module under
modelseedpy/ imports from `tests`.
This change alone breaks test collection: three test modules import
`tests.test_data.mock_data` absolutely, and until now that only resolved
through the copy in site-packages. The next commit fixes that, and the two
must land together.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…solve
Three test modules import the suite absolutely:
tests/core/test_msbuilder.py from tests.test_data.mock_data import ...
tests/core/test_mseditorapi.py from tests.test_data.mock_data import ...
tests/fbapkg/test_revbin_core_model.py from tests.test_data.mock_data import ...
tox runs pytest with `changedir = tests`, so the repo root is never on
sys.path, and `tests` resolved only through the copy that setup.py was
installing by mistake. With that copy gone (previous commit), collection
stops with three `ModuleNotFoundError: No module named 'tests'`.
pytest's default prepend import mode walks up from each test file while the
directory has an `__init__.py` and inserts the first directory that does not.
tests/ and tests/test_data/ have one; tests/biochem, tests/community,
tests/core and tests/fbapkg did not, so their modules got their own directory
as basedir and no route to `tests`. Adding the four files makes the repo root
the basedir for every test module.
Measured the way tox runs it (non-editable install, pytest from tests/):
dev 67e8284 96 passed
previous commit alone 3 errors during collection, interrupted
previous commit + this commit 96 passed
One consequence: with the repo root on sys.path, the tests import modelseedpy
from the checkout rather than from the installed copy. That is inherent to a
flat layout; a src/ layout would avoid it but is a larger change. It is also
why the warning count rises from 5 to 39: the extra ones are invalid-escape
DeprecationWarnings (e.g. modelseedpy/core/fbahelper.py:101) raised when the
checkout's modules are compiled, which the precompiled installed copy did not
report. They are not new.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This fixes three small configuration defects on
dev. One of them is ours: #173 added a test file without the encoding pragma, and the pre-commit job has been red ondevsince67e8284.1. Pre-commit on
dev: the missing pragma (1ded9c8)tests/fbapkg/test_package_manager_exports.py(from #173) lacks# -*- coding: utf-8 -*-, sofix-encoding-pragmafails. This is a one-line addition, and every other test module already has the line. Sorry for letting that one through.2.
check-executables-have-shebangsonly passes in CI (613aa63)In
.pre-commit-config.yaml,types: [python]on this hook replaces the manifest'stypes: [text, executable]; it does not narrow it. The hook is therefore handed every.pyfile. On a normal clone, wherecore.fileModeis true (the default), pre-commit-hooks v4.3.0 then flags 97 modules as "marked executable but has no shebang". None of them is executable. CI hides this only becausepre-commit.ymlsetscore.filemode falsefirst. Removing the override restores the manifest's filter, and the hook passes under either setting.3.
pip install modelseedpyinstalls a top-leveltestspackage (4212e95+1cb833a, which must land together)find_packages(exclude=("docs"))passes a string, not a tuple, so nothing is excluded. Every install therefore addstestsandtests.test_datato site-packages. The exclude now namesdocsandteststogether with their subpackages.That change alone stops test collection. Three test modules import
tests.test_data.mock_dataabsolutely, and under tox (changedir = tests) that name resolved only through the copy installed by mistake. Adding__init__.pytotests/biochem,tests/community,tests/coreandtests/fbapkgmakes the repo root pytest's basedir for every test module, so the import resolves from the checkout.Tests. I measured the way tox runs them: a non-editable install, with pytest run from
tests/.dev67e8284__init__.pyfilesPre-commit on this branch: every hook passes, with
core.fileModeboth true and false.One side effect is worth knowing about. With the repo root on
sys.path, the tests importmodelseedpyfrom the checkout rather than from the installed copy, so pytest's warning count rises from 5 to 39. The extra warnings are existing invalid-escapeDeprecationWarnings (for examplecore/fbahelper.py:101) that surface when the checkout is compiled. None of them is new.Alternatives, if you'd prefer them:
devgoes green before the rest is reviewed.src/layout, so the tests run against the installed copy. That is a larger change, which is why I haven't proposed it here.🤖 Generated with Claude Code