Closed Bug 1390573 Opened 7 years ago Closed 7 years ago

Clean up stale pyc files during Vagrant provision

Categories

(Tree Management :: Treeherder, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Since otherwise if paths have changed in the meantime (eg if previously there was an attempt to run the tests outside the VM, when the host is Windows and doesn't use unix style paths), pytest fails with the rather unhelpful:

"""
vagrant ~/treeherder $ pytest tests/etl/test_buildbot.py
Traceback (most recent call last):
  File "/home/vagrant/python/lib/python2.7/site-packages/_pytest/config.py", line 379, in _importconftest
    mod = conftestpath.pyimport()
  File "/home/vagrant/python/lib/python2.7/site-packages/py/_path/local.py", line 680, in pyimport
    raise self.ImportMismatchError(modname, modfile, self)
ImportMismatchError: ('tests.conftest', 'c:\\Users\\elvis\\treeherder\\tests\\conftest.py', local('/home/vagrant/treeher
der/tests/conftest.py'))
ERROR: could not load /home/vagrant/treeherder/tests/conftest.py
"""

(As hit by Joel today: https://pastebin.mozilla.org/9029781)

These stale pyc files are easy to miss when debugging, since they are (/have to be) git ignored.
Commits pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/729183f41f88f5c4070e0069e2f6ac3c2bfcadf4
Bug 1390573 - Vagrant: Move the cleanup step earlier in provision

To reduce the risk that one of the commands we run is broken by things
that need cleaning up (eg pyc files). An unnecessary `|| true` has also
been removed from the `rm -f` moved command.

https://github.com/mozilla/treeherder/commit/1fee79052b34049163c6d737386de6fb0efbdbac
Bug 1390573 - Vagrant: Remove .pyc files during provision

To prevent confusing pytest `ImportMismatchError` exceptions if the
paths hardcoded in pyc files (which are git-ignored) leftover from
the past, don't match the paths used now.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Blocks: 1416266
Component: Treeherder: Docs & Development → TreeHerder
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: