Closed buhtz closed 4 years ago
Does the error occur with the latest version of Green? (3.1.3 at the moment)
Is your code publicly available? (Can I look at it?)
The code is not public - but just because of the current quality state. So no problem for me if someone else looks into it. I attached an archive and I am open for all suggestions about improving that code.
Currently I am in a big refactoring phase. Creating tests for that code is also part of that phase. It is the first time I try to use tests in a "real" coding project. btw: The official (but empty) repository of the projects can be found and a very cool and free code hosting plattform https://codeberg.org/buhtz/Feedybus .
Since my first posting I modified the code. So please see here the output I can reproduce with the code from the attached archive.
This is unittest
run
$ python3 -m unittest discover -v
>>> Create "/home/user/.local/share/feedybus/entries.UNITTEST.60M0A7Y9T1324TWWIKHJYML"
>>> Create "/home/user/.local/share/feedybus/favicons.UNITTEST.60M0A7Y9T1324TWWIKHJYML"
Feeds file does not exist. Create a default file...
test_singleton (tests.test_data.TestFeedsData) ... ok
<<< Removed directory tree /home/user/.local/share/feedybus/favicons.UNITTEST.60M0A7Y9T1324TWWIKHJYML.
<<< Removed directory tree /home/user/.local/share/feedybus/entries.UNITTEST.60M0A7Y9T1324TWWIKHJYML.
ERROR
>>> Create "/home/user/.local/share/feedybus/entries.UNITTEST.GBK2A4IUNE9SMPJARP1MZAFH"
>>> Create "/home/user/.local/share/feedybus/favicons.UNITTEST.GBK2A4IUNE9SMPJARP1MZAFH"
ERROR
======================================================================
ERROR: tearDownModule (tests.test_data)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/user/Downloads/Feedybus_for_green/tests/test_data.py", line 26, in tearDownModule
helper.clear_profile()
File "/home/user/Downloads/Feedybus_for_green/tests/helper.py", line 46, in clear_profile
bascis.log_filename()]:
NameError: name 'bascis' is not defined
======================================================================
ERROR: setUpModule (tests.test_group)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/user/Downloads/Feedybus_for_green/tests/test_group.py", line 31, in setUpModule
data.FeedsData()
File "/home/user/Downloads/Feedybus_for_green/feedybus/data.py", line 65, in __init__
raise Exception('Only one instance of FeedsData can exist.')
Exception: Only one instance of FeedsData can exist.
----------------------------------------------------------------------
Ran 1 test in 0.008s
FAILED (errors=2)
This is green
:
green --process 1 -vvv -a
Green 3.0.0, Coverage 4.5.4, Python 3.7.3
>>> Create "/home/user/.local/share/feedybus/entries.UNITTEST.H1K"
>>> Create "/home/user/.local/share/feedybus/favicons.UNITTEST.H1K"
Feedybus_for_green.tests.test_data
TestFeedsData
. test_singleton
>>> Create "/home/user/.local/share/feedybus/entries.UNITTEST.G3T3G5E0BDHW0L"
>>> Create "/home/user/.local/share/feedybus/favicons.UNITTEST.G3T3G5E0BDHW0L"
green.suite
GreenTestSuite
E setUpModulee.GreenTestSuite
Error in unittest.suite._ErrorHolder.setUpModule
File "/usr/lib/python3.7/unittest/suite.py", line 200, in _handleModuleFixture
setUpModule()
File "/home/user/Downloads/Feedybus_for_green/tests/test_group.py", line 31, in setUpModule
data.FeedsData()
File "/home/user/Downloads/Feedybus_for_green/feedybus/data.py", line 65, in __init__
raise Exception('Only one instance of FeedsData can exist.')
Exception: Only one instance of FeedsData can exist.
Ran 2 tests in 0.107s using 1 process
FAILED (errors=1, passes=1)
The "problem" with the code is in the file tests/helper.py
at line 46 - where a simple misspelling occured.
This one was tricky! Thanks to your bug report, I was able to identify and fix a bug that has been present in Green for years that has masked errors in module- or class-level teardowns! ❤️
The fix is included in Green 3.1.4 (just released).
Oh, and it's the 🥧 release, how fun! 😁
I can confirm that this is fiex in 3.1.4. Thanks a lot.
btw: I would like to see green
as part of the official debian repository. I know it is not easy. ;)
btw: I would like to see
green
as part of the official debian repository. I know it is not easy. ;)
I'm glad you like it that much!
I try to understand the differences in the output between
green
andunittest
because the latter shows me a very important exception. Please look for the lineNameError: name 'bascis' is not defined
in that code:Now you see the output of
green
where this error (a simple typo by the way) is missing but very important because it is in thetearDownClass()
methode.Maybe I missunderstood or missconfigured something here?