Registry / testing / flake8-junit-report-basic

flake8-junit-report-basic

JSON →
library3.0.0pypypiunverified

flake8-junit-report-basic is a simple Python command-line tool (version 3.0.0) that converts the output from Flake8 static analysis into the JUnit XML format. This conversion facilitates integration with Continuous Integration (CI) systems like Jenkins or CircleCI, allowing them to display Flake8 failures alongside other test results. The project shows recent activity with its 3.0.0 release, though its historical context includes an older, unmaintained fork.

pip install flake8-junit-report-basic
INSTALL
IMPORT
SIG · FLAKE8-JUNIT-REPOR
F
flake8-junit-report-basic
testingpythonv3.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

The quickstart demonstrates how to use `flake8-junit-report-basic` by first running `flake8` to generate a text report, and then using the `flake8_junit` command-line utility to convert that report into a JUnit XML file. This JUnit XML file can then be consumed by CI/CD tools. Ensure `flake8` is installed and a `my_module.py` file with some Flake8 issues is present for a meaningful report.

# 1. Create a dummy Python file with a Flake8 error Path('my_module.py').write_text('import os; x = 1 ') # E222, W292 # 2. Run Flake8 and save its output to a file # This simulates the output that flake8_junit expects result = subprocess.run( ['flake8', '--output-file', 'flake8_report.txt', 'my_module.py'], capture_output=True, text=True ) # 3. Convert the Flake8 output file to JUnit XML format # The executable is named 'flake8_junit' junit_result = subprocess.run( ['flake8_junit', 'flake8_report.txt', 'junit_report.xml'], capture_output=True, text=True ) # Optional: Print the generated JUnit XML content print(Path('junit_report.xml').read_text())
flake8-junit-report --version
Debug
Known issues
breakingVersion 3.0.0 introduces a significant change by generating individual testcases for each Flake8 error, rather than one testcase per file. This new output structure for the JUnit XML may break existing CI pipelines or tools that rely on the previous XML format.
fix
Review and update CI pipeline configurations or XML parsing logic to accommodate the new granular testcase structure in the JUnit report.
affects: >=3.0.0
gotchaThe command-line executable provided by the `flake8-junit-report-basic` package is named `flake8_junit`, not `flake8-junit-report-basic`. Users should invoke `flake8_junit` directly after installation.
fix
Always use `flake8_junit` as the command when interacting with the installed package. E.g., `flake8_junit input.txt output.xml`.
affects: All
gotchaThere are older, unmaintained forks (e.g., `initios/flake8-junit-report`) with similar names whose GitHub READMEs display 'WARNING: Not mantained'. Ensure you are referring to the active `ricardogarfe/flake8-junit-report` repository and installing `flake8-junit-report-basic` for the latest version and active development.
fix
Verify the GitHub repository is `https://github.com/ricardogarfe/flake8-junit-report` and that the PyPI package is `flake8-junit-report-basic` to ensure you are using the actively maintained version.
affects: All
Errors
Common errors & fixes
flake8_junit: command not found
The `flake8_junit` executable is not found in the system's PATH, often because a virtual environment isn't activated or the Python script directory isn't added to PATH.
fix
Ensure your Python virtual environment is activated, or that the directory containing `flake8_junit` (e.g., `~/.local/bin` or your virtual environment's `bin`/`Scripts` directory) is in your system's PATH. On Windows, the error might appear as `'flake8_junit' is not recognized as an internal or external command, operable program or batch file.`
usage: flake8_junit [-h] input_file output_file flake8_junit: error: the following arguments are required: input_file, output_file
The `flake8_junit` command was invoked without the required input and output file arguments.
fix
You need to first run `flake8` and direct its output to a text file, then provide that text file as the input and specify an output JUnit XML file. Example: `flake8 > flake8_report.txt` then `flake8_junit flake8_report.txt junit_report.xml`.
flake8-junit-report-basic: command not found
Developers often mistakenly try to run the tool using its PyPI package name (`flake8-junit-report-basic`) instead of its actual command-line executable name, which is `flake8_junit`.
fix
Always use `flake8_junit` as the command after installation, not `flake8-junit-report-basic`. Example: `pip install flake8-junit-report-basic` followed by `flake8_junit input.txt output.xml`.
Upgrade
Version history
3.0.0latest on PyPI · released Oct 4, 2022
Audit
Dependencies
flake8requiredRequired to generate the initial static analysis report which this tool converts.
Agent activity
5 hits · last 30 days
node
4
Resources
flake8-junit-report-basic — pip install flake8-junit-report-basic · libregistry