New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve unit tests #191
Improve unit tests #191
Conversation
7e5af79
to
f03c8b9
Compare
f03c8b9
to
447a844
Compare
cf59f94
to
38922e7
Compare
Changes Unknown when pulling 38922e7 on tstenner:test_asserts into ** on bleachbit:master**. |
38922e7
to
7c6c6b9
Compare
Changes Unknown when pulling 7c6c6b9 on tstenner:test_asserts into ** on bleachbit:master**. |
Changes Unknown when pulling f6d77e8 on tstenner:test_asserts into ** on bleachbit:master**. |
Changes Unknown when pulling 77c3f78 on tstenner:test_asserts into ** on bleachbit:master**. |
Changes Unknown when pulling 1bc6410 on tstenner:test_asserts into ** on bleachbit:master**. |
Changes Unknown when pulling f4c46b6 on tstenner:test_asserts into ** on bleachbit:master**. |
Changes Unknown when pulling a0e2540 on tstenner:test_asserts into ** on bleachbit:master**. |
Changes Unknown when pulling a75a5ef on tstenner:test_asserts into ** on bleachbit:master**. |
Changes Unknown when pulling c925c41 on tstenner:test_asserts into ** on bleachbit:master**. |
c925c41
to
9ec8306
Compare
9ec8306
to
ed370d5
Compare
|
||
|
||
class AssertFile: | ||
class BleachbitTestCase(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good idea to use inheritance here
cmd = 'cmd.exe /c dir' | ||
if 'posix' == os.name: | ||
cmd = 'dir' | ||
cmds = {'nt': 'cmd.exe /c dir', 'posix': 'dir'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a creative use of a dictionary. Nice.
self.assert_(os.path.exists(path)) | ||
self.assert_(os.path.getsize(path) > 0) | ||
self.assertExists(path) | ||
self.assertGreater(os.path.getsize(path), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertGreater is another benefit of Python 2.7+
for test in tests_undo: | ||
self.assertEqual(extended_path_undo(test[0]), test[1]) | ||
for short, extended in tests: | ||
# already extended path shouldn't be changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are logical tests
This is great work. I love a cleanup like this that reduces code. I could merge this now, but would you rather wait? I see only 2/4 items are checked off. |
I am seeing merge conflicts with this. Will need to fix that first. |
I'd rather go through the last remaining files first and then rebase the PR, after that I'd also be in favor of merging it (less conflicts for me and everyone else). I can always open another PR for the remaining items. |
Are we holding back Python 3 coding for the next update then? |
@tstenner OK, please write a note when it's ready. @ROCKNROLLKID I would like to hold major changes including Python 3 and GTK 3 until after BleachBit 2.0 is released. Then it may also take a follow-up maintenance release to fix important regressions. After that I would like to evaluate how well Python 3 and GTK 3 work, especially on Windows. Given the recent work to shrink the new GTK 2 on Windows for BleachBit 2.0, I assume that I can also shrink Python 3 and GTK 3. This pull request is a stepping stone for Python 3 because it improves test coverage. |
ed370d5
to
77d91c8
Compare
4c4956f
to
06f95f4
Compare
2a01aef
to
0aa45ad
Compare
37d3e12
to
1369d9c
Compare
The test for locked files fails because the worker reports that it cleaned too many bytes (6 instead of 3), but I (think I) didn't change anything relevant in the failing test. Could someone with a windows installation take a look at it? |
The error 6 != 3 looks like something I broke related to the new WindowsWipe code. I will work on it. |
The 6 != 3 error was fixed in commit 193e07a |
7e8380a
to
984ee27
Compare
984ee27
to
d0be80a
Compare
The unit tests pass now, travis hits a time limit somehow (downloading the appveyor artifacts?). We should merge this, I'll tackle the rest of the todo-list in a separate PR |
Yes, Travis hit a time limit waiting on AppVeyor, while Appveyor failed because of the errno typo. |
For an eventual py3-transition we need better unit test coverage.
What's planned / done:
self.assert_
to more meaningful asserts (especiallyself.assert_(isinstance(...))