Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Call test from other module #375

Open
WolfDWyc opened this issue Dec 10, 2023 · 0 comments
Open

Call test from other module #375

WolfDWyc opened this issue Dec 10, 2023 · 0 comments

Comments

@WolfDWyc
Copy link

WolfDWyc commented Dec 10, 2023

I noticed this behavior:

# a.py

def make_tests(a, b)

    @test("{a} + {b} = {b} + {a}")
    def _(a=a, b=b):
        assert a + b == b + a
   
    @test("{a} * 2 == {a} + {a}")
    def _(a=a):
       assert a * 2 == a + a
# b.py
make_tests(2, 3)
make_tests(4, 8)

Doesn't detect the tests.

It appears to be caused by this line in testing.py:

        is_home_module: bool = "." not in module_name
        if is_test_module_name(module_name) and is_home_module:

@darrenburns I'm wondering what's the reason for this? Why do the tests have to be declared in the home module?

Is there any other way to do this?

@WolfDWyc WolfDWyc changed the title Call fixture from other module Call test from other module Dec 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant