tox -e pep8 bandit failing with ERROR Unknown test found in profile: B320

Bug #2094783 reported by chandan kumar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
watcher-tempest-plugin
Fix Released
High
chandan kumar

Bug Description

Below are the steps to reproduce this issue.
```
git clone https://github.com/openstack/watcher-tempest-plugin
cd watcher-tempest-plugin
tox -e pep8
```
Here is the traceback
```
chandankumar@raukadahlaptop:/tmp/watcher-tempest-plugin$ tox -e pep8
pep8: install_deps> pip install -chttps://releases.openstack.org/constraints/upper/master -r /tmp/watcher-tempest-plugin/test-requirements.txt
pep8: commands[0]> doc8 doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
Scanning...
Validating...
/tmp/watcher-tempest-plugin/.tox/pep8/lib/python3.13/site-packages/doc8/parser.py:69: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  opt = frontend.OptionParser(components=[parser], defaults=defaults)
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/tmp/watcher-tempest-plugin/.tox/pep8/lib/python3.13/site-packages/doc8/parser.py:69: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  opt = frontend.OptionParser(components=[parser], defaults=defaults)
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/tmp/watcher-tempest-plugin/.tox/pep8/lib/python3.13/site-packages/doc8/parser.py:69: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  opt = frontend.OptionParser(components=[parser], defaults=defaults)
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/tmp/watcher-tempest-plugin/.tox/pep8/lib/python3.13/site-packages/doc8/parser.py:69: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  opt = frontend.OptionParser(components=[parser], defaults=defaults)
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/tmp/watcher-tempest-plugin/.tox/pep8/lib/python3.13/site-packages/doc8/parser.py:69: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  opt = frontend.OptionParser(components=[parser], defaults=defaults)
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/tmp/watcher-tempest-plugin/.tox/pep8/lib/python3.13/site-packages/doc8/parser.py:69: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  opt = frontend.OptionParser(components=[parser], defaults=defaults)
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
========
Total files scanned = 6
Total files ignored = 0
Total accumulated errors = 0
Detailed error counts:
    - doc8.checks.CheckCarriageReturn = 0
    - doc8.checks.CheckIndentationNoTab = 0
    - doc8.checks.CheckMaxLineLength = 0
    - doc8.checks.CheckNewlineEndOfFile = 0
    - doc8.checks.CheckTrailingWhitespace = 0
    - doc8.checks.CheckValidity = 0
pep8: commands[1]> flake8
pep8: commands[2]> bandit -r watcher_tempest_plugin -x tests -n5 -ll -s B320
/tmp/watcher-tempest-plugin/.tox/pep8/lib/python3.13/site-packages/bandit/core/utils.py:364: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
  node = getattr(ast, name)
[main] INFO profile include tests: None
[main] INFO profile exclude tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: B320
[main] ERROR Unknown test found in profile: B320
pep8: exit 2 (0.11 seconds) /tmp/watcher-tempest-plugin> bandit -r watcher_tempest_plugin -x tests -n5 -ll -s B320 pid=95226
  pep8: FAIL code 2 (12.45=setup[11.98]+cmd[0.13,0.23,0.11] seconds)
  evaluation failed :( (12.49 seconds)
```
[main] ERROR Unknown test found in profile: B320 is the actual error.

Based on https://bandit.readthedocs.io/en/latest/plugins/index.html#complete-test-plugin-listing and https://github.com/PyCQA/bandit/commit/e4da0b351f89a82b5de8dd791cbdd963476b5a11 B320 got removed in last release.

It will break the pep8 job.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to watcher-tempest-plugin (master)
Changed in watcher-tempest-plugin:
status: New → In Progress
Ronelle Landy (rlandy)
Changed in watcher-tempest-plugin:
importance: Undecided → High
assignee: nobody → chandan kumar (chkumar246)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher-tempest-plugin (master)

Reviewed: https://review.opendev.org/c/openstack/watcher-tempest-plugin/+/939213
Committed: https://opendev.org/openstack/watcher-tempest-plugin/commit/6b0a38b45b8d866edd5b64d696d6c4bf344d6e67
Submitter: "Zuul (22348)"
Branch: master

commit 6b0a38b45b8d866edd5b64d696d6c4bf344d6e67
Author: Chandan Kumar (raukadah) <email address hidden>
Date: Tue Jan 14 15:55:25 2025 +0530

    Drop bandit B320 profile to fix pep8 job

    https://github.com/PyCQA/bandit/commit/e4da0b351f89a82b5de8dd791cbdd963476b5a11
    drops B320 profile from blacklist. Bandit no longer identify this
    profile leading to tox -e pep8 failure.

    By removing it from skip, it fixes the issue.

    Closes-Bug: #2094783

    Change-Id: I4452e28733450266b9a7b1083b8ff4b1bd0477e1
    Signed-off-by: Chandan Kumar (raukadah) <email address hidden>

Changed in watcher-tempest-plugin:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/watcher-tempest-plugin 3.4.0

This issue was fixed in the openstack/watcher-tempest-plugin 3.4.0 Epoxy release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.