D
D
d3coy_002019-10-01 13:16:01
Python
d3coy_00, 2019-10-01 13:16:01

Test run order in python unittest?

Hello, I can't understand the order of launching files with tests:
-there is a structure like this:
5d9326e027691764755761.png
Launch command: python -m unittest discover -s "." -p "*.py"
Why is the test A10_MATA030 run first, A9_MATA020 is the last to run. Accordingly, the last A11 does not work at all, what's the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d3coy_00, 2019-10-01
@d3coy_00

The problem is solved, the system compares file names in its own way. In this case, A1_ is compared with A10_. We get:

[A] [1] [0] [_]
 |   |   |   |
[A] [1] [_] [None]

I think so, if we look at the representation of the characters "0" and "_" from the file name:
ord (0) == 48
ord (_) == 95
We get that the file name that contains the character "0" - >(A10) in the same digit where A1 has "_" ->(A1_) is higher in priority, respectively A1_ is lower than A10_. The solution to the problem is renaming [A1_] -> [A01_]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question