I have a use case in selenium in which the priority of test functions are important. I'm using LiveServerTestCase
in flask for tests.
In Java, there is a decorator @Test(priority=0)
for defining test priorities. My question is what is the equivalent in Flask?

- 121,510
- 29
- 395
- 339

- 29
- 4
2 Answers
This may not answer your question as I have no knowledge nor experience with LiveServerTestCase, I am more of a pytest guy, and if you ever go down the pytest path, look up
https://github.com/ftobia/pytest-ordering/blob/develop/docs/source/index.rst
import pytest
@pytest.mark.order2
def test_foo():
assert True
@pytest.mark.order1
def test_bar():
assert True
Having said that, I looked at flask-testing documentation (I am assuming you are using this extension), it supports nose collector and test runner.
https://flask-testing.readthedocs.io/en/latest/#with-nose
And as per nose documentation, the tests run in the order they are defined in the test module file.
https://nose.readthedocs.io/en/latest/writing_tests.html#writing-tests
You can leverage the nose test runner. Again, my apologize this post does not help you.

- 1,976
- 1
- 15
- 19
Test functions are executed according to their names(alphabetical order).

- 29
- 4
-
I have doubts. Can you give some more insights how you're coming to this insight? – colidyre Feb 24 '22 at 21:44