Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#17393 closed Bug (fixed)

Test runner should exclude __pycache__ directories

Reported by: Ian Clelland Owned by: nobody
Component: Testing framework Version: dev
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

Description

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, init.py 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.

Reference: http://www.python.org/dev/peps/pep-3147/

Attachments (1)

17393.patch (491 bytes ) - added by Ian Clelland 13 years ago.
Quick patch to exclude bytecode cache dirs

Download all attachments as: .zip

Change History (6)

by Ian Clelland, 13 years ago

Attachment: 17393.patch added

Quick patch to exclude bytecode cache dirs

comment:1 by Ian Clelland, 13 years ago

Has patch: set

comment:2 by Luke Plant, 13 years ago

Triage Stage: UnreviewedAccepted

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 by Ian Clelland, 13 years ago

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 by Claude Paroz, 13 years ago

Resolution: fixed
Status: newclosed

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

comment:5 by Claude Paroz <claude@…>, 13 years ago

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