pytest-cmake icon indicating copy to clipboard operation
pytest-cmake copied to clipboard

Impossible to trim test prefix when using class

Open buddly27 opened this issue 1 year ago • 0 comments

When a test is embedded within a class, the TRIM_FROM_NAME option from the "pytest_discover_tests" function applies to the class name instead of the method name.

class TestWorld:
    def test_greet(self):                                                                                                                                                                  
        """Greet the world."""
        assert example.greet() == "hello, world"
test 1
    Start 1: PythonTest.TestWorld.test_greet

We should create a TRIM_FROM_CLASS_NAME function to trim class names and fix the existing TRIM_FROM_NAME option to make it work with methods for consistency.

buddly27 avatar Mar 17 '24 18:03 buddly27