nosetests does another output (ImportError) then simple unittest (No Error) Why?
Question: When i make a simple Test with unittest only it does not show any error. But
when i try to nosetests my test files it does a ImportError. Here are the
nessesary Informations.

# Project Structure:

    
    
    -rwxrwxr-x __init__.py
    -rw-rw-r-- __init__.pyc
    drwxrwxr-x romannumeralconverter
    drwxrwxr-x tests
    
    ./romannumeralconverter:
    -rwxrwxr-x __init__.py
    -rw-rw-r-- __init__.pyc
    -rwxrwxr-x romannumeralconverter.py
    -rw-rw-r-- romannumeralconverter.pyc
    
    ./tests:
    -rwxrwxr-x __init__.py
    -rw-rw-r-- __init__.pyc
    -rw-rw-r-- romannumeralconvertertest.py
    -rw-rw-r-- romannumeralconvertertest.pyc
    

# Testfile - romannumeralconvertertest.py:

    
    
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    import unittest
    from romannumeralconverter.romannumeralconverter import RomanNumeralConverter
    
    class RomanNumeralConverterTest(unittest.TestCase):
        def test_parsing_millenia(self):
            """Testing if millenia"""
            value = RomanNumeralConverter("M")
            self.assertEquals(1000, value.convert_to_decimal())
    
        #@unittest.skip("demonstrating skipping")
        def test_parsing_century(self):
            value = RomanNumeralConverter("C")
            self.assertEquals(100, value.convert_to_decimal())
    
        def test_parsing_half_century(self):
            value = RomanNumeralConverter("L")
            self.assertEquals(50, value.convert_to_decimal())
    
    if __name__ == "__main__":
        suite = unittest.TestLoader().loadTestsFromTestCase(RomanNumeralConverterTest)
        unittest.TextTestRunner(verbosity=3).run(suite)
    

# Appfile: - romannumeralconverter.py:

    
    
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    class RomanNumeralConverter(object):
        def __init__(self, roman_numeral):
            self.roman_numeral = roman_numeral
            self.digit_map = {"M": 1000, "D": 500, "C": 100, "L": 50, "X": 10, "V": 5, "I": 1}
            self.i_rule = ('V','X')
            self.x_rule = ('L','C')
            self.c_rule = ('D','M')
            self.rules = {"I": self.i_rule, "X": self.x_rule, "C": self.c_rule}
    
        def zwei_convert_to_decimal(self):
            val = 0
            oldelement = 0
            for char in self.roman_numeral:
                if oldelement != 0 and self.digit_map[char] > self.digit_map[oldelement]:
                    pass
                oldelement = char
    
        def convert_to_decimal(self):
            val = 0
            for char in self.roman_numeral:
                val += self.digit_map[char]
            return val
    

# Normal Test output:

    
    
    ▶ python romannumeralconvertertest.py
    test_parsing_century (__main__.RomanNumeralConverterTest) ... ok
    test_parsing_half_century (__main__.RomanNumeralConverterTest) ... ok
    test_parsing_millenia (__main__.RomanNumeralConverterTest)
    Testing if millenia ... ok
    
    ----------------------------------------------------------------------
    Ran 3 tests in 0.000s
    
    OK
    

# nosetests output:

    
    
    ▶ nosetests romannumeralconvertertest.py
    E
    ======================================================================
    ERROR: Failure: ImportError (cannot import name RomanNumeralConverter)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 420, in loadTestsFromName
        addr.filename, addr.module)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
        return self.importFromDir(dir_path, fqname)
      File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
        mod = load_module(part_fqname, fh, filename, desc)
      File "/home/username/Development/learning/romannumeralconverter/tests/romannumeralconvertertest.py", line 5, in <module>
        from romannumeralconverter.romannumeralconverter import RomanNumeralConverter
    ImportError: cannot import name RomanNumeralConverter
    
    ----------------------------------------------------------------------
    Ran 1 test in 0.000s
    
    FAILED (errors=1)
    

# sys.path

    
    
    /home/username/Development/learning/romannumeralconverter/tests
    /home/username/Development/learning/romannumeralconverter/tests
    /home/username/Development/learning/romannumeralconverter
    /usr/lib/python2.7
    /usr/lib/python2.7/plat-x86_64-linux-gnu
    /usr/lib/python2.7/lib-tk
    /usr/lib/python2.7/lib-old
    /usr/lib/python2.7/lib-dynload
    /home/username/.local/lib/python2.7/site-packages
    /usr/local/lib/python2.7/dist-packages
    /usr/lib/python2.7/dist-packages
    /usr/lib/python2.7/dist-packages/gtk-2.0
    /usr/lib/python2.7/dist-packages/ubuntu-sso-client
    


Answer: By default nose makes some adjustments to the `sys.path`. There is one
possible solution you can find here: [Accepted answer of - Python Nose Import
Error](http://stackoverflow.com/questions/3073259/python-nose-import-
error/3073368#3073368).

From your project structure, if you delete the `__init__.py` from:

    
    
    /home/username/Development/learning/romannumeralconverter
    

directory, it should work.

