Repository: python-trio/pytest-trio (language: python)

Issue:
`trio_mode` automark breaks when Pytest `item` has no `.obj` attribute
This leads to bad interactions with other plugins such as [Sybil](https://github.com/simplistix/sybil), which add custom doctest items that don't have this attribute.  PR incoming...


Discussion / hints:

Fix patch:
diff --git a/newsfragments/132.bugfix.rst b/newsfragments/132.bugfix.rst
new file mode 100644
index 0000000..4850310
--- /dev/null
+++ b/newsfragments/132.bugfix.rst
@@ -0,0 +1,1 @@
+Fix a bad interaction with custom pytest items that do not include an ``.obj`` attribute.


Test patch:
diff --git a/pytest_trio/plugin.py b/pytest_trio/plugin.py
index 6638d67..1a56a83 100644
--- a/pytest_trio/plugin.py
+++ b/pytest_trio/plugin.py
@@ -508,6 +508,9 @@ def pytest_fixture_setup(fixturedef, request):
 
 def automark(items, run=trio.run):
     for item in items:
+        if not hasattr(item, "obj"):
+            # Rare and a little strange, but happens with some doctest-like plugins
+            continue
         if hasattr(item.obj, "hypothesis"):
             test_func = item.obj.hypothesis.inner_test
         else: