title: Missing required dependencies when testing with py.test
body: <p>I have a python file which contains classes and functions and a </p>
  
  <pre><code>if __name__ == "__main__":
      ...
  </code></pre>
  
  <p>construct. I want to test a class which is defined in this file with py.test. For my first "hello world"-test, my test-file only imports the file to be tested.</p>
  
  <p>Running py.test in PyCharm results however in</p>
  
  <pre><code>raceback (most recent call last):
    File "[...]/unittest/datageneration_test.py", line 1, in &lt;module&gt;
      from main.datageneration import *
    File "[...]/main/datageneration.py", line 1, in &lt;module&gt;
      import pandas as pd
    File "[...]/lib/python3.6/site-packages/pandas/__init__.py", line 19, in &lt;module&gt;
      "Missing required dependencies {0}".format(missing_dependencies))
  ImportError: Missing required dependencies ['numpy']
  </code></pre>
  
  <p>My file to be tested has the import statements</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  from scipy.special import expit
  import sys
  import os
  import scipy.io.wavfile as wav
  import json
  import uuid
  </code></pre>
  
  <p>My conda environment.yml is</p>
  
  <pre><code>channels:
  - conda-forge
  - defaults
  dependencies:
  - pandas=0.20.3
  - numpy=1.13.1
  - ggplot=0.11.5
  - python=3.6.2
  - pytest=3.2.1
  </code></pre>
  
  <p>What is the issue here?</p>