Can also advice to make a virtual environment(build into Python) then search path to folder will work.
Example setup.
Example setup.
myproject/ │ ├── Browser/ │ ├── __init__.py # Makes Browser a Python package │ │ │ ├── src/ │ │ ├── __init__.py │ │ └── URL.py │ │ │ └── test/ │ ├── __init__.py │ └── test_URL.py │ └── other_project_files/ # Other project files (if any)Start like this:
# Make G:\env λ python -m venv myproject G:\env λ cd myproject\ # In Linux source bin/activate G:\env\myproject λ G:\env\myproject\Scripts\activate # Now working see (myproject) G:\env\myproject (myproject) λ # Eg make folder folders/files from command line or use OS file explorer G:\env\myproject (myproject) λ mkdir Browser G:\env\myproject\Browser (myproject) λ touch __init__.py ....Test run.
G:\env\myproject\Browser\test (myproject) λ rich test_URL.py # Advice use pytest instead import unittest import Browser.src.URL class test_URL(unittest.TestCase): def test_init(self): test_URL = "https://python-forum.io" self.assertEqual(test_URL, Browser.src.URL.web_url()) if __name__ == '__main__': unittest.main() G:\env\myproject\Browser\test (myproject) λ python test_URL.py . ---------------------------------------------------------------------- Ran 1 test in 0.000s OK G:\env\myproject\Browser\test (myproject) λ