0

I want to divide my tests up into seperate folders so that they are organized. I tried a couple of things but it seems like it can't find my test.

The structure looks like this

-- root
   -- setup.py
   -- docs
   -- src
   -- tests
      -- __init__.py
      -- defaultTest.py
      -- DirA
         -- testA.py
      -- DirB
         -- testB.py

So I want to run testA but it can't find the module. I also tried to add a init.py file but that didn't work I'm able to launch the defaultTest.py however with python setup.py test -s tests.defaultTest but not the other ones.

My setup.py file looks like this:

# -*- coding: utf-8 -*-

from setuptools import setup, find_packages


with open('README') as f:
    readme = f.read()

setup(
    name='ringring',
    version='0.1.0',
    description='Sample package for Python-Guide.org',
    long_description=readme,
    url='',
    license=license,
    packages=find_packages(exclude=('tests', 'docs')),
    tests_require=['nose'],
    test_suite='tests',
)

Any help would be appreciated, thanks for reading!

John
  • 728
  • 2
  • 15
  • 37
  • What is in your `init.py` file? – Dschoni Sep 24 '18 at 11:58
  • the init file of the test folder is empty, do you think I should import the two folder underneath? – John Sep 24 '18 at 11:59
  • It's just an educated guess after reading https://stackoverflow.com/questions/17001010/how-to-run-unittest-discover-from-python-setup-py-test – Dschoni Sep 24 '18 at 12:02
  • especially this comment: https://stackoverflow.com/a/23307488/1866177 – Dschoni Sep 24 '18 at 12:03
  • Ok I did somewhat what you told me. I added a context file which returns the absolute url and did an import of it and that seems to work. I still need to figure out how it exactly works. Anyway thanks for the tip! – John Sep 25 '18 at 06:29

0 Answers0