#25 WIP: Add basic regex unit tests
Merged by nphilipp. Opened by patrikp.
patrikp/mirrors-countme regex_unit_tests  into  main

Download 25.patch

Added basic unit tests which pass when the log lines are parsed correctly, and a couple of additional tests which check log lines of an invalid format, thus passing when the regexes (intentionally) do not match. Split the original test_regex.py file into individual respective tests, as to make comprehension easier and more clear when adding new tests etc..

Relevant issue: #19

Looked through the code, zuul is only complaining about few lines being too long, so that should be easy to fix :)

Personally, I would rather have the tests in single file, the convention usually is 1-to-1 corespondence of testfile to file being tested.

Second, I see you are repeating a small piece of test quite a lot, this could be served well by parametrizing the test instead: https://docs.pytest.org/en/6.2.x/parametrize.html#parametrize-basics

On the other hand, the tests are small so maybe parametrizing might be more trouble than worth.

rebased onto 1929578bea2494595e8ffc082752fd74bf09daa1

rebased onto cf5cefd717a5d59bc778b0249fdbd04d275b26c6

1 new commit added

  • Resolve merge conflict

The individual tests have been concatenated into a single file again, as to uphold testing conventions. All lines are now =< 100 characters. There's a minor change to one of the regex patterns. The test for COUNTME_USER_AGENT_RE has been parametrized. I will now work on parametrizing the remaining tests.

1 new commit added

  • Parametrize all the tests

1 new commit added

  • Fix incorrect test

rebased onto 2af394231fc4223ca7e9404e16ba2a26057a1783

Build succeeded.

Pull-Request has been merged by nphilipp

Metadata