Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 946690f4be
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return subprocess.run( | ||
| [sys.executable, "-m", "magic"] + list(args), | ||
| cwd=str(ROOT), | ||
| check=False, | ||
| capture_output=True, |
There was a problem hiding this comment.
Keep CLI tests compatible with the supported runtimes
When the documented default tox matrix is run with the interpreters listed in tox.ini (py27, py35, and py36), this helper cannot execute: Python 2.7 has no subprocess.run, capture_output was added only in Python 3.7, and the f-strings later in this file fail to parse before Python 3.6. Because setup.py:32 still advertises Python 2.7+ and these environments remain explicitly configured, this commit makes those test jobs fail before exercising the entry point; use subprocess and formatting/path APIs available across the supported matrix.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e927a9a: the helper now uses Popen.communicate() and os.path; f-strings, capture_output, text, and the newer tmp_path fixture are gone. Native Python 3.13 full suite still passes (20 passed, 2 skipped). I also ran all six CLI tests with real libmagic in an official Python 3.5.10 Linux container: all passed. Python 2.7.18 compiles both source files and passes CLI argument/error-flow checks with a stub backend; I have not run its full suite. The PR validation notes now distinguish those scopes.
Closes #337.
Add
python -m magic FILE...using the existingfrom_file()API, plus--mimefor MIME output. File-access and libmagic exceptions are reported on stderr without stopping the remaining files; the command returns 1 if any of those calls failed.The tests use
Popen.communicate(),os.path,tmpdir, and legacy-compatible formatting to follow the supported tox matrix.Six new tests cover descriptions, MIME output, a missing file followed by a valid file, Unicode paths, missing arguments, and a libmagic exception. All six fail without the entry point. The full suite passes with 20 passed and 2 existing skips; mypy and Ruff checks pass. Both wheel and sdist build and contain the entry point, and the installed wheel was smoke-tested outside the checkout on Python 3.13/macOS arm64 with libmagic 5.48. The six CLI tests also pass in an official Python 3.5.10 Linux container with real libmagic. On Python 2.7.18, the CLI and test source compile, and CLI argument/error-flow checks pass with a stub backend; the full Python 2.7 suite was not run. Other Python/platform combinations were not run locally.
No new dependencies or changes to the recognition API. Prepared and tested with OpenAI Codex; not human-reviewed before submission.