Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC : synchronous test #642

Closed
cbeauchesne opened this issue Nov 9, 2022 · 0 comments
Closed

POC : synchronous test #642

cbeauchesne opened this issue Nov 9, 2022 · 0 comments
Assignees

Comments

@cbeauchesne
Copy link
Collaborator

As now, test are asynchronous :

class TestCase():
    def test_case(self):
        # some setup code that should not fails
        r = get_weblog()
        # real test logic asyncronously
        interface.weblog.assert_waf_attack(r)

It's painful because

  • we have to hack pytest to rewrite failure (test_case never fails)
  • if test_case fails, we have to hack pytest to give the output
  • if test_case fails, but is flagged as xfail, the error is silent
  • and there are lot of hack to decorate asynchronous validation

It may be possible to change this to stick to a pure pytest code style :

class TestCase():
    def setup_case(self):
        self.r = get_weblog()

    def test_case(self):
        interface.weblog.assert_waf_attack(self.r)  # now synchronous

The test executor will look like :

collect
execute all setup_XXXX (need to be writted)
wait interfaces
execute test
  1. no more asynchronous test
  2. no more dirty hack to collect metadata

The only draw back is that object set in setup is no more sticked to the test logic. But I think it's reasonnable.

This was referenced Nov 23, 2022
@cbeauchesne cbeauchesne self-assigned this Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant