title: Pytest - Can't access imported class' attributes?
body: <p><strong>Problem Summary:</strong>
  When trying to access class methods of a class/Luigi tasks that I am trying to test, it states that the class does not have the methods I am trying to use.</p>
  <p><strong>More Detail:</strong>
  I am attempting to test a class/Luigi task I have written. I am trying to import the class I am testing into a test file to use its methods. However, when I try and import it, I can only access the class and not the methods inside it. None of its methods are accessible. I know I can import the class successfully because when I print an instance of it, it shows the object with correct attribute names.</p>
  <p><strong>Here are any details I think might give context and help possibly lend a clue to resolving this:</strong></p>
  <p>Project File Structure:</p>
  <pre><code>src
  |
  | - &lt;folder containing code&gt;
  | | - foo.py
  |
  | - tests
  | | - resources
  |   | - count.csv
  |
  | | - test_example.py
  | - pytest.ini
  </code></pre>
  <p><code>foo.py</code> contains the class that I am testing. The class has the following structure:</p>
  <pre><code>import luigi
  
  class Foo(luigi.Task):
     attr1 = luigi.Parameter()
     attr2 = luigi.ListParameter()
  
     def requires(self):
         None
  
     def output(self):
        &lt;not important&gt;
  
     def _helper_method_1():
        &lt;CODE&gt;
  
     def _helper_method_2():
        &lt;CODE&gt;
  
     def run(self):
  
        &lt;code that uses all the helper methods&gt;
  
              .
              .
              .
  
  
  </code></pre>
  <p>I am trying to run tests to test the helper methods in this class.</p>
  <p>Here is the code I have in <code>test_example.py</code>:</p>
  <pre><code>import pytest
  import sys
  sys.path.append('../&lt;folder containing code&gt;/')
  from &lt;folder containing code&gt;.foo import Foo
  
  @pytest.fixture
  def base():
      return Foo('hi',[])
  
  def test_me(base):
      print(base)
      value = base._helper_method_1('./resources/count.csv')
      assert value == 3
  </code></pre>
  <p>Running pytest gives me the following error:</p>
  <p><code>FAILED tests/test_example.py::test_me - AttributeError: 'Foo' object has no attribute '_helper_method_1'</code></p>
  <p>And the following is printed:
  <code>Foo(attr1='', attr2=[])</code>
  This shows that the class is at least somewhat imported because it is mapping attribute names to the arguments I put in for the base fixture.</p>
  <p>I have been stuck on this some time, trying different ways of importing the class in <code>test_example.py</code>:</p>
  <p>Importing just the file:</p>
  <pre><code>sys.path.append('../&lt;folder containing code&gt;/')
  from &lt;folder containing code&gt; import foo
  </code></pre>
  <p>Importing just the class:</p>
  <pre><code>sys.path.append('../&lt;folder containing code&gt;/')
  from &lt;folder containing code&gt; import Foo
  </code></pre>
  <p>Please let me know if you have any recommendations or questions about information I may not have included that might help.</p>
  <p>Thank you!</p>