
# Standard library imports
import sys

# Third party imports
import pytest

pytest.main(sys.argv[1:])


# Standard library imports
import sys

# Third party imports
import pytest


class SpyderPlugin():
    """Pytest plugin which reports in format suitable for Spyder."""

    def pytest_itemcollected(self, item):
        """Called by py.test when a test item is collected."""
        name = item.name
        module = item.parent.name
        module = module.replace('/', '.')  # convert path to dotted path
        if module.endswith('.py'):
            module = module[:-3]
        print('pytest_item_collected(name={}, module={})'.format(name, module))


pytest.main(sys.argv[1:], plugins=[SpyderPlugin()])

Add py.test plugin which prints out test names as they are collected
Add py.test plugin which prints out test names as they are collected

  
  # Standard library imports
  import sys
  
  # Third party imports
  import pytest
  
- pytest.main(sys.argv[1:])
  
+ class SpyderPlugin():
+     """Pytest plugin which reports in format suitable for Spyder."""
+ 
+     def pytest_itemcollected(self, item):
+         """Called by py.test when a test item is collected."""
+         name = item.name
+         module = item.parent.name
+         module = module.replace('/', '.')  # convert path to dotted path
+         if module.endswith('.py'):
+             module = module[:-3]
+         print('pytest_item_collected(name={}, module={})'.format(name, module))
+ 
+ 
+ pytest.main(sys.argv[1:], plugins=[SpyderPlugin()])
+ 
Add py.test plugin which prints out test names as they are collected
## Code Before:

# Standard library imports
import sys

# Third party imports
import pytest

pytest.main(sys.argv[1:])

## Instruction:
Add py.test plugin which prints out test names as they are collected
## Code After:

# Standard library imports
import sys

# Third party imports
import pytest


class SpyderPlugin():
    """Pytest plugin which reports in format suitable for Spyder."""

    def pytest_itemcollected(self, item):
        """Called by py.test when a test item is collected."""
        name = item.name
        module = item.parent.name
        module = module.replace('/', '.')  # convert path to dotted path
        if module.endswith('.py'):
            module = module[:-3]
        print('pytest_item_collected(name={}, module={})'.format(name, module))


pytest.main(sys.argv[1:], plugins=[SpyderPlugin()])
