title: Create and import helper functions in tests without creating packages in test directory using py.test
body: <p><strong>Question</strong></p>
  
  <p>How can I import helper functions in test files without creating packages in the <code>test</code> directory?</p>
  
  <p><br />
  <strong>Context</strong></p>
  
  <p>I'd like to create a test helper function that I can import in several tests.  Say, something like this:</p>
  
  <pre><code># In common_file.py
  
  def assert_a_general_property_between(x, y):
      # test a specific relationship between x and y
      assert ...
  
  
  # In test/my_test.py
  
  def test_something_with(x):
      some_value = some_function_of_(x)
      assert_a_general_property_between(x, some_value)
  </code></pre>
  
  <p><em>Using Python 3.5, with py.test 2.8.2</em></p>
  
  <p><br />  </p>
  
  <p><strong>Current "solution"</strong></p>
  
  <p>I'm currently doing this via importing a module inside my project's <code>test</code> directory (which is now a package), but I'd like to do it with some other mechanism if possible (so that my <code>test</code> directory doesn't have packages but just tests, and the tests can be run on an installed version of the package, as is recommended <a href="http://pytest.org/latest/goodpractises.html#choosing-a-test-layout-import-rules">here in the py.test documentation on good practices</a>).</p>