title: Pytest does not find pyYAML in Travis CI tests that have PyPI and conda package dependencies
body: <p>I am trying to set up automatic testing for <a href="https://github.com/valentinaschueller/scriptengine-tasks-ecearth" rel="nofollow noreferrer">my Python package</a> using Travis CI. My Python package depends on <a href="https://github.com/SciTools/iris/" rel="nofollow noreferrer">Iris</a> as well as other packages such as PyYAML, numpy, etc. It also depends on a PyPI package (<a href="https://pypi.org/project/scriptengine" rel="nofollow noreferrer">ScriptEngine</a>). Now, I would like to set up a Travis CI environment using conda (to install Iris) and pip (to install the PyPI package as well as checking the requirements for PyYAML and numpy). I would then like to install my package using <code>pip install .</code>.</p>
  
  <p>To test if this works, I have written one simple Pytest test that imports PyYAML.</p>
  
  <p>I am currently trying to do this using this <code>.travis.yml</code> file:</p>
  
  <pre class="lang-yaml prettyprint-override"><code>language: python
  python:
    - "3.6"
    - "3.7"
    - "3.8"
  # command to install dependencies
  install:
    - sudo apt-get update
    - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
    - bash miniconda.sh -b -p $HOME/miniconda
    - source "$HOME/miniconda/etc/profile.d/conda.sh"
    - hash -r
    - conda config --set always_yes yes --set changeps1 no
    - conda update -q conda
    # Useful for debugging any issues with conda
    - conda info -a
    - conda env create -f tests/test-environment.yml python=$TRAVIS_PYTHON_VERSION
    - conda activate test-environment
    - conda install pip
    - conda install -c conda-forge iris
    - pip install -r requirements.txt
    - pip install .
  # command to run tests
  script: pytest
  </code></pre>
  
  <p>Note: This is the first time for me to really work with Travis CI. This script is a mixture of examples from the <a href="https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/use-conda-with-travis-ci.html" rel="nofollow noreferrer">Conda docs</a> as well as the Travis CI docs.</p>
  
  <p>Pytest then fails to import PyYAML (although it gets installed because of the requirements.txt as well as the Iris dependencies):
  Here is the confirmation from the logs that it got installed:</p>
  
  <pre><code>Requirement already satisfied: pyYAML&gt;=5.1 in /home/travis/miniconda/envs/test-environment/lib/python3.8/site-packages (from ece-4-monitoring==0.1.0) (5.3.1)
  </code></pre>
  
  <p>And this is the Error from Pytest:</p>
  
  <pre><code>$ pytest
  
  ============================= test session starts ==============================
  
  platform linux -- Python 3.7.1, pytest-4.3.1, py-1.7.0, pluggy-0.8.0
  
  rootdir: /home/travis/build/valentinaschueller/ece-4-monitoring, inifile:
  
  collected 1 item / 1 errors                                                    
  
  ==================================== ERRORS ====================================
  
  _________________ ERROR collecting tests/test_file_handling.py _________________
  
  ImportError while importing test module '/home/travis/build/valentinaschueller/sciptengine-tasks-ecearth/tests/test_file_handling.py'.
  
  Hint: make sure your test modules/packages have valid Python names.
  
  Traceback:
  
  tests/test_file_handling.py:3: in &lt;module&gt;
  
      import helpers.file_handling as file_handling
  
  helpers/file_handling.py:1: in &lt;module&gt;
  
      import yaml
  
  E   ModuleNotFoundError: No module named 'yaml'
  
  !!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
  
  =========================== 1 error in 0.12 seconds ============================
  
  The command "pytest" exited with 2.
  </code></pre>
  
  <p>If I try this exact setup using a conda virtual environment locally on my computer, I do not get this problem. Why does this not work on the Travis CI virtual machine?</p>