I want to run unit tests using unittest
module, this is the file organization of my project:
frac
├── frac.py
├── __init__.py
└── test
└── run_tests.py
The code inside run_tests.py
is:
import unittest
from frac import Fraction
class RunFractionTests(unittest.TestCase):
def test_dunder_mul(self):
self.assertEqual(Fraction(1, 2) * Fraction(1, 2), Fraction(1, 4))
if __name__ == "__main__":
unittest.main()
The problem is, when i run run_tests.py
with python run_tests.py
, i get an error saying that the module frac
was not found, this is the error message:
Traceback (most recent call last):
File "/home/maurothecreator/Área de Trabalho/Projects/HighMath/frac/test/run_tests.py", line 2, in <module>
from frac import Fraction
ModuleNotFoundError: No module named 'frac'
Am i importing this in the wrong way, if so, how can i fix this?