title: pytest AttributeError: 'Function' object has no attribute 'get_marker'
body: <p>I have this code in my <code>conftest.py</code>:</p>
  
  <pre class="lang-py prettyprint-override"><code>def pytest_collection_modifyitems(config, items):
      items.sort(key=lambda x: 2 if x.get_marker('slow') else 1)
  </code></pre>
  
  <p>Lately it started to cause these exceptions:</p>
  
  <pre><code>$ venv/bin/py.test  -vv --tb=short tests
  ============================================================================ test session starts ============================================================================
  platform darwin -- Python 3.5.6, pytest-4.1.1, py-1.7.0, pluggy-0.8.1 -- /Users/.../venv/bin/python3.5
  cachedir: .pytest_cache
  rootdir: /Users/..., inifile:
  collecting ... INTERNALERROR&gt; Traceback (most recent call last):
  INTERNALERROR&gt;   File "/Users/.../venv/lib/python3.5/site-packages/_pytest/main.py", line 203, in wrap_session
  ...
  INTERNALERROR&gt;   File "/Users/.../venv/lib/python3.5/site-packages/pluggy/callers.py", line 187, in _multicall
  INTERNALERROR&gt;     res = hook_impl.function(*args)
  INTERNALERROR&gt;   File "/Users/.../tests/conftest.py", line 14, in pytest_collection_modifyitems
  INTERNALERROR&gt;     items.sort(key=lambda x: 2 if x.get_marker('slow') else 1)
  INTERNALERROR&gt;   File "/Users/.../tests/conftest.py", line 14, in &lt;lambda&gt;
  INTERNALERROR&gt;     items.sort(key=lambda x: 2 if x.get_marker('slow') else 1)
  INTERNALERROR&gt; AttributeError: 'Function' object has no attribute 'get_marker'
  
  ======================================================================= no tests ran in 0.30 seconds ================================================
  </code></pre>