title: pytest fails with "ERROR: file or directory not found: and"
body: <p>pytest has been working for me forever. Today, after rebooting, it throws this error:</p>
  <pre><code>PS C:\&gt; pytest
  ================================================= test session starts =================================================
  platform win32 -- Python 3.9.1, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
  rootdir: C:\
  plugins: forked-1.3.0, html-3.1.1, metadata-1.11.0, xdist-2.2.0
  collected 0 items
  
  ================================================ no tests ran in 0.01s ================================================
  ERROR: file or directory not found: and
  </code></pre>
  <p>It doesn't matter if I run in a valid pytest framework or outside the framework.  I uninstalled pytest and python and then reinstalled with the same results. I tried running &quot;python -m pytest&quot; and same results. I am running Windows 10, python 3.8 or 3.9. What am I missing?</p>
  <p>Here's some additional output using the debug flag</p>
  <pre><code>PS C:\&gt; mkdir empty_directory
  
      Directory: C:\
  
  Mode                LastWriteTime         Length Name
  ----                -------------         ------ ----
  d-----        1/14/2021   8:23 PM                empty_directory
  
  PS C:\&gt; cd empty_directory
  PS C:\empty_directory&gt; python -m pytest -vvv --debug
  writing pytestdebug information to C:\empty_directory\pytestdebug.log
  ================================================= test session starts =================================================
  platform win32 -- Python 3.9.1, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 -- C:\Users\611528\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe
  using: pytest-6.2.1 pylib-1.10.0
  setuptools registered plugins:
    pytest-forked-1.3.0 at C:\Users\611528\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytest_forked\__init__.py
    pytest-html-3.1.1 at C:\Users\611528\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytest_html\plugin.py
    pytest-metadata-1.11.0 at C:\Users\611528\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytest_metadata\plugin.py
    pytest-xdist-2.2.0 at C:\Users\611528\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\xdist\plugin.py
    pytest-xdist-2.2.0 at C:\Users\611528\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\xdist\looponfail.py
  cachedir: .pytest_cache
  metadata: {'Python': '3.9.1', 'Platform': 'Windows-10-10.0.18362-SP0', 'Packages': {'pytest': '6.2.1', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins': {'forked': '1.3.0', 'html': '3.1.1', 'metadata': '1.11.0', 'xdist': '2.2.0'}, 'JAVA_HOME': 'C:\\Program Files\\Java\\jdk-15.0.1'}
  rootdir: C:\empty_directory
  plugins: forked-1.3.0, html-3.1.1, metadata-1.11.0, xdist-2.2.0
  collected 0 items
  
  ================================================ no tests ran in 0.04s ================================================
  wrote pytestdebug information to C:\empty_directory\pytestdebug.log
  ERROR: file or directory not found: and
  </code></pre>
  <p>The log file is pretty big so I'll go through it to see if there's anything that jumps out.</p>
  <p>Okay, this is interesting:</p>
  <pre><code>    finish pytest_sessionstart --&gt; [] [hook]
      pytest_collection [hook]
          session: &lt;Session empty_directory exitstatus=&lt;ExitCode.OK: 0&gt; testsfailed=0 testscollected=0&gt;
      perform_collect &lt;Session empty_directory exitstatus=&lt;ExitCode.OK: 0&gt; testsfailed=0 testscollected=0&gt; ['and', 'level1'] [collection]
          pytest_collection_finish [hook]
              session: &lt;Session empty_directory exitstatus=&lt;ExitCode.OK: 0&gt; testsfailed=0 testscollected=0&gt;
            pytest_report_collectionfinish [hook]
                config: &lt;_pytest.config.Config object at 0x0000025C74701FD0&gt;
                startdir: C:\empty_directory
                items: []
            finish pytest_report_collectionfinish --&gt; [] [hook]
          finish pytest_collection_finish --&gt; [] [hook]
        pytest_sessionfinish [hook]
            session: &lt;Session empty_directory exitstatus=&lt;ExitCode.USAGE_ERROR: 4&gt; testsfailed=0 testscollected=0&gt;
            exitstatus: ExitCode.USAGE_ERROR
          pytest_terminal_summary [hook]
              terminalreporter: &lt;_pytest.terminal.TerminalReporter object at 0x0000025C74C0F550&gt;
              exitstatus: ExitCode.USAGE_ERROR
              config: &lt;_pytest.config.Config object at 0x0000025C74701FD0&gt;
          finish pytest_terminal_summary --&gt; [] [hook]
        finish pytest_sessionfinish --&gt; [] [hook]
        pytest_unconfigure [hook]
            config: &lt;_pytest.config.Config object at 0x0000025C74701FD0&gt;
        finish pytest_unconfigure --&gt; [] [hook]
  </code></pre>
  <p>What is this line doing:</p>
  <pre><code>perform_collect &lt;Session empty_directory exitstatus=&lt;ExitCode.OK: 0&gt;
   testsfailed=0 testscollected=0&gt; ['and', 'level1'] [collection]
  </code></pre>
  <p>Maybe that's where it's getting the 'and'.  This line caught my attention because I have a marker called 'level1' in one of my pytest frameworks.  But I'm not in that directory so it could be unrelated.</p>
  <p>If I switch to my macbook and run pytest in an empty directory, that line looks like:</p>
  <pre><code>perform_collect &lt;Session temp exitstatus=&lt;ExitCode.OK: 0&gt; 
  testsfailed=0 testscollected=0&gt; ['/Users/jhayden/temp'] [collection]
  </code></pre>
  <p>And that's the empty directory I ran from.</p>
  <p>I also tried running in a venv:</p>
  <pre><code>C:\venvs&gt;python -m venv aaa
  
  C:\venvs&gt;cd aaa\Scripts
  
  C:\venvs\aaa\Scripts&gt;.\activate.bat
  
  (aaa) C:\venvs\aaa\Scripts&gt;pip install pytest
  Collecting pytest
    Using cached pytest-6.2.1-py3-none-any.whl (279 kB)
  Collecting py&gt;=1.8.2
    Using cached py-1.10.0-py2.py3-none-any.whl (97 kB)
  Collecting colorama; sys_platform == &quot;win32&quot;
    Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
  Collecting packaging
    Using cached packaging-20.8-py2.py3-none-any.whl (39 kB)
  Collecting toml
    Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
  Collecting iniconfig
    Using cached iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
  Collecting atomicwrites&gt;=1.0; sys_platform == &quot;win32&quot;
    Using cached atomicwrites-1.4.0-py2.py3-none-any.whl (6.8 kB)
  Collecting pluggy&lt;1.0.0a1,&gt;=0.12
    Using cached pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
  Collecting attrs&gt;=19.2.0
    Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
  Collecting pyparsing&gt;=2.0.2
    Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
  Installing collected packages: py, colorama, pyparsing, packaging, toml, iniconfig, atomicwrites, pluggy, attrs, pytest
  Successfully installed atomicwrites-1.4.0 attrs-20.3.0 colorama-0.4.4 iniconfig-1.1.1 packaging-20.8 pluggy-0.13.1 py-1.10.0 pyparsing-2.4.7 pytest-6.2.1 toml-0.10.2
  WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
  You should consider upgrading via the 'c:\venvs\aaa\scripts\python.exe -m pip install --upgrade pip' command.
  
  (aaa) C:\venvs\aaa\Scripts&gt;pytest
  ================================================= test session starts =================================================
  platform win32 -- Python 3.9.1, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
  rootdir: C:\venvs\aaa\Scripts
  collected 0 items
  
  ================================================ no tests ran in 0.01s ================================================
  ERROR: file or directory not found: and
  </code></pre>