Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#17393 closed Bug (fixed)

Test runner should exclude __pycache__ directories

Reported by: clelland Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords: Testing Python3 pycache
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Beginning with Python 3.2, the Python runtime now stores .pyc files in a subdirectory named __pycache__, rather than alongside their counterpart .py sources. These directories are created automatically any time that the code is imported in a Python3.2+ environment.

The test runner needs to explicitly ignore those directories when searching for tests, as it does with hidden files and directories, files, and dirs named 'sql'. Currently, the full (auto-discovered) test suite will not run after tests have been run with Python 3.

This may have implications for other auto discovery mechanisms as well.


Attachments (1)

17393.patch (491 bytes) - added by clelland 4 years ago.
Quick patch to exclude bytecode cache dirs

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by clelland

Quick patch to exclude bytecode cache dirs

comment:1 Changed 4 years ago by clelland

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by lukeplant

  • Triage Stage changed from Unreviewed to Accepted

This could be filed against the py3k branch on bitbucket, or we could just apply it after that work has been merged. I don't see a need to apply it before we have any support for Python 3 in trunk.

comment:3 Changed 4 years ago by clelland

Agreed; I figured it would sit here until 1.4 was released, at least; I just didn't want to have it forgotten. I'll see about pushing this up to bitbucket as well.

comment:4 Changed 4 years ago by claudep

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in 865cd35c9b357e20994f6c6a51f2ae000ba0a3ee (was inadvertantly pushed as a more broader cleanup).

comment:5 Changed 4 years ago by Claude Paroz <claude@…>

In [eb0140bddca4d25be2bf02144f43b1b12b0cbed3]:

Hidden pycache dirs for FilePathField. Refs #17393.

This will be tested as soon as tests will run under Python 3. Patch
taken from Vinay Sajip's Python 3 branch.

Note: See TracTickets for help on using tickets.
Back to Top