there is no suite setup execute info in the log
only display the test setup log. but there is no suite setup info . I am sure the suite or session setup is exetuted.
hmm, i thought pytest didn't really have a concept of suite-level setup and teardown, only fixtures that get called by individual tests as they're needed. but reading into it more i see it supports setup_module and teardown_module functions. i could probably hook those to make them show in the log as suite-level setup/teardowns.
could you please confirm that's how you're defining your suite setup? or are there other ways to do it?
only this function has been logged
ok so there's a few reasons for this:
- the logs from your listener don't work because robot itself doesn't support logging outside of a test from a listener
- the
pytest_sessionstartone doesn't get logged because that hook is called at the very beginning of the pytest session before any tests are collected and before robot starts, which means it's impossible for robot to know about it - the session-scoped fixtures are lazily executed (ie. only executed when a test needs them). for example, the following test suite will execute the functions in the following order:
test_foo,setup, thentest_bar:@fixture(scope="session") def setup(): info("1") # runs second def test_foo(): info("2") # runs first def test_bar(setup: None): info("3") # runs last
i'm going to make some changes that should make setup_module and teardown_module show up as suite setups in the log, so i would recommend doing it that way
actually, even setup_module and teardown_module only get executed in the setup/teardown stage of an individual test (the first or last one in a suite), so i think think supporting it would be difficult, and it would also cause issues if i add support for xdist in the future (#98), since the contents of the "setup" keyword would appear to be duplicated if a suite is split across multiple runners.
i'll keep this issue open for now but i'm not sure if it's feasible
when I use setup_module, it has been executed before each test case, My hopes is it execute only once before the module.
@fixture(scope="session") def setup(): logging.info("1") the fixture did't execute. when I and autouse=True, It also executed before each test case.
what version of the plugin are you using? i suspect that's the same issue as #161 which was fixed in the latest version (2.5.1)
it's working now, after upgrade to 2.5.1. Thanks for you kindly reply