Hi I am new to python I found that if we use pytest, fixtures that defined in conftest.py can be directly referenced without needing import in test module. Similarly, if we are using pytest-mock, a fixture called mocker can be referenced any where in the test modules as long as the test is triggered by pytest, no need to do import either. I think there must be one or multiple python language features that enable such kind of thing. What are they? If your answers can assume that I am from Java/C++ background that will be great!
the pytest fixture system registers fixtures by name, and then looks those names up in the fixture registry, not the actual python module you are currently in
so you dont need to import them in each test module, and plugins for pytest can provide them
Why pytest can reference fixture without import?