Closed s-kganz closed 4 years ago
Describe the bug Instantiating a MeshLinePlot anywhere in a unit testing script prevents pytest and unittest from discovering and running tests.
MeshLinePlot
pytest
unittest
To Reproduce Uncomment either MeshLinePlot() call in the below script.
MeshLinePlot()
# test_container.py import unittest from kivy_garden.graph import MeshLinePlot #mesh = MeshLinePlot() class Container(): def __init__(self, id): self.id = id #self.mesh = MeshLinePlot() class TestOne(unittest.TestCase): def test_dummy(self): print('In dummy_test()') self.assertEqual(1, 1) def test_class_init(self): print('In test_class_init()') c = Container(1) self.assertEqual(c.id, 1) if __name__ == '__main__': unittest.main()
Expected behavior Unit tests are discovered and run as expected with pytest and/or unittest.
Logs/output Result when uncommenting the instantiation in Container:
Container
> python test_container.py [INFO ] [Logger ] Record log in C:\Users\ganzk\.kivy\logs\kivy_20-07-28_13.txt [INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.2.0 [INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.2.0 [INFO ] [Kivy ] v1.11.1 [INFO ] [Kivy ] Installed at "c:\Users\ganzk\Desktop\peaks\kivy_env\lib\site-packages\kivy\__init__.py" [INFO ] [Python ] v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] [INFO ] [Python ] Interpreter at "c:\Users\ganzk\Desktop\peaks\kivy_env\Scripts\python.exe" [INFO ] [Factory ] 184 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored) [INFO ] [Text ] Provider: sdl2 In test_class_init()
Using pytest instead:
=== test session starts === > pytest test_container.py platform win32 -- Python 3.7.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 rootdir: C:\Users\ganzk\Desktop\peaks collected 0 items == no tests ran in 0.00s ==
Platform (please complete the following information):
My bad, unit tests using any kivy graphics instruction need to inherit from the proper test case class. Not an issue with this repo at all. See the SO thread here for a working version of the above script.
Describe the bug Instantiating a
MeshLinePlot
anywhere in a unit testing script preventspytest
andunittest
from discovering and running tests.To Reproduce Uncomment either
MeshLinePlot()
call in the below script.Expected behavior Unit tests are discovered and run as expected with
pytest
and/orunittest
.Logs/output Result when uncommenting the instantiation in
Container
:Using pytest instead:
Platform (please complete the following information):