Skip to content
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

Not collecting any test case written in pytest #3

Open
ankitkgupta09 opened this issue May 20, 2020 · 4 comments
Open

Not collecting any test case written in pytest #3

ankitkgupta09 opened this issue May 20, 2020 · 4 comments

Comments

@ankitkgupta09
Copy link

This tool is not collecting a test case written in Pytest.

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python38\lib\tkinter_init_.py", line 1883, in call
return self.func(*args)
File "C:\openscource\pytest-gui\view.py", line 605, in cmd_reload_tests
self.reload_project(self.testdir_name.get())
File "C:\openscource\pytest-gui\view.py", line 513, in reload_project
self.project = self.load_project(self.root, self.Model, testdir)
File "C:\openscource\pytest-gui\view.py", line 483, in project
self._add_test_module('', testModule)
File "C:\openscource\pytest-gui\view.py", line 453, in _add_test_module
for testMethod_name, testMethod in sorted(testCase.items()):
AttributeError: 'TestMethod' object has no attribute 'items'

@fkreiner
Copy link

@ankitkgupta09 Any news on this? Did you manage to load pytest cases?

@ankitkgupta09
Copy link
Author

@fkreiner No this did not work for me, is this work on unittest or pytest? my test cases are written using pytest.

@hmurari
Copy link
Contributor

hmurari commented Aug 24, 2021

Sorry for the delay in response, I had missed the notification earlier. This was originally tested with tests written in unittest framework. Usually - we write all our test cases through unittest, and pytest just works seamlessly with those anyway. Can you point me to some sample pytest test cases where this is not working?

@fkreiner
Copy link

fkreiner commented Nov 8, 2022

I tried some simple tests from the pytest examples

import pytest

def capital_case(x):
    return x.capitalize()

def test_capital_case():
    assert capital_case('semaphore') == 'Semaphore'

def test_raises_exception_on_non_string_arguments():
    with pytest.raises(TypeError):
        capital_case(9)

Pytest will execute those tests. pytest-gui does not show or execute them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants