erratic test behaviour
timeyyy opened this issue · comments
im interested in making this code compatible with python 2 and 3, python 3 works pretty well using 2to3.py, but the get_root() function isn't working for me.
Im using windows 7, testing is done on unaltered code from this repo
_running python2 -m py.test tests_
collected 33 items
during testing i get a few uac dialog boxes which i confirm
only ever passed once without errors, There are sometimes 2 sometimes 3 tests that are failed.
_testing with tox -e py27:_
collected 30
No uac dialog prompts
The tests pass 50% of the time under tox, when it fails its because of the error pasted below.
I'd like some guidance on my next actions, i feel i need to get the tests working 100% of the time before moving on. Not sure what the best course of action is.
Does any one know why tox is collecting different amount of tests?
mytox.ini
[tox]
envlist = py27, py33, py34
[testenv]
deps=pytest
commands=py.test
_Here is the error that gets thrown the most when running under tox and py.test_
self = <esky.tests.test_esky.TestPatch_pybsdiff testMethod=test_diffing_back_and
_forth>
def tearDown(self):
esky.patch.bsdiff4 = self.__orig_bsdiff4
> return super(TestPatch_pybsdiff,self).tearDown()
test_esky.py:765:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_esky.py:649: in tearDown
shutil.rmtree(self.workdir)
C:\Python27\lib\shutil.py:247: in rmtree
rmtree(fullname, ignore_errors, onerror)
C:\Python27\lib\shutil.py:256: in rmtree
onerror(os.rmdir, path, sys.exc_info())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = 'D:\\STORAGE\\Dropbox\\programming\\testesky\\unchanged\\esky\\tests\\pat
ch-test-temp.win32\\source'
ignore_errors = False, onerror = <function onerror at 0x03BBFA70>
def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is the argument to that function that caused it to fail; and
exc_info is a tuple returned by sys.exc_info(). If ignore_errors
is false and onerror is None, an exception is raised.
"""
if ignore_errors:
def onerror(*args):
pass
elif onerror is None:
def onerror(*args):
raise
try:
if os.path.islink(path):
# symlinks to directories are forbidden, see bug #1669
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, path, sys.exc_info())
# can't continue even if onerror hook returns
return
names = []
try:
names = os.listdir(path)
except os.error, err:
onerror(os.listdir, path, sys.exc_info())
for name in names:
fullname = os.path.join(path, name)
try:
mode = os.lstat(fullname).st_mode
except os.error:
mode = 0
if stat.S_ISDIR(mode):
rmtree(fullname, ignore_errors, onerror)
else:
try:
os.remove(fullname)
except os.error, err:
onerror(os.remove, fullname, sys.exc_info())
try:
> os.rmdir(path)
E WindowsError: [Error 145] The directory is not empty: 'D:\\STORAGE\\
Dropbox\\programming\\testesky\\unchanged\\esky\\tests\\patch-test-temp.win32\\s
ource'
C:\Python27\lib\shutil.py:254: WindowsError
==================== 3 failed, 30 passed in 143.72 seconds ====================
Press any key to continue . . .
Does any one know why tox is collecting different amount of tests?
Some tests are only activated if certain freezer programs are installed, e.g. it will only run the py2exe tests if py2exe is installed.
return super(TestPatch_pybsdiff,self).tearDown()
Hmm...it's been a good long while since I touched this code, but I do remember the tempfile cleanup being pretty unreliable on windows. The simplest option may be to either (a) ignore errors when cleaning up tempfiles from the tests, or (b) add a loop to sleep-and-retry the rmtree
call until it succeeds.
i noticed there are quite a few open pull requests, is there any way i can help close them?
i noticed there are quite a few open pull requests, is there any way i can help close them?
@timeyyy indeed, the truth is I just don't have the bandwidth to keep up with this project these days, and since I'm not using it for any active projects anymore it's hard to make the time. If you're interested, it would be great to get your comments on any of the open PRs and we can work towards getting them merged.
As you noted here, one of the big problems with maintenance on this project is that the tests are kinda flaky. It would be great to get travis-ci or similar hooked up on here to give a bit more confidence with moving the code forward on different platforms. If you have the interest and the time, I'd be delighted to help you work towards such a setup.
:thumbsup Lets do this!
@rfk im looking into setting up travis-ci, would you be able to enable it for the repo and also send a message to support requesting multi-os testing as per
http://docs.travis-ci.com/user/multi-os/
support@travis-ci.com
something like this
Hello i would like to test my repo cloudmatrix/esky on multiple operating systems.