Changes between Version 1 and Version 2 of Ticket #33454, comment 4


Ignore:
Timestamp:
Jan 28, 2022, 5:00:31 AM (3 years ago)
Author:
Thorben Luepkes

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33454, comment 4

    v1 v2  
    77Thanks for the quick reply.
    88
    9 This seems like a weird change to make to me?
    10 Why would you change the way tags work?
    11 Of course it is a problem in our code somehow, but cant there be a setting so we can revert it?
    12 
    139I would really like to be able to share the whole codebase, but as you might know, thats not really possible. We serve two different markets with the same codebase, and have market specific tests: Main market runs 1000 tests, and market b just runs 27 tests that are specific to that market.
    1410But due to the change to tags, the test-suit tries to include apps into the test that arent in `INSTALLED_APPS`. I have dumped out the variable during the test, and it does not have the apps where the error is thrown even included.
    1511
    1612We run test like so:
    17 ```
    18             python3.9 manage.py test --exclude-tag=functional --timing # Main Market, no functional test
    19             MARKET=market_b python3.9 manage.py test --tag=market_b --exclude-tag=functional --timing # The other market, also no functional tests
    20 ```
     13
     14
     15{{{
     16python3.9 manage.py test --exclude-tag=functional --timing # Main Market, no functional test
     17MARKET=market_b python3.9 manage.py test --tag=market_b --exclude-tag=functional --timing # The other market, also no functional tests
     18}}}
     19
     20
     21
     22Could it maybe have to do with:
     23
     24
     25
     26{{{
     27from xmlrunner.extra.djangotestrunner import XMLTestRunner
     28
     29from.market_settings.markets import MARKET_B
     30
     31
     32class CustomTestSuiteRunner(XMLTestRunner):
     33    """Custom test runner which excludes market-specific tests by default if no tests are specified."""
     34    def build_suite(self, test_labels=None, extra_tests=None, **kwargs):
     35        if MARKET_BE not in self.tags and not test_labels:
     36            self.exclude_tags.add(MARKET_B)
     37        return super().build_suite(test_labels, extra_tests, **kwargs)
     38
     39    def get_resultclass(self):
     40        if strtobool(os.environ.get("PROFILE_TESTS", "0")):
     41            return ProfilingTestResult
     42        else:
     43            return super().get_resultclass()
     44}}}
     45
     46Printing these tags give me:
     47
     48{{{
     49Including test tag(s): MARKET_B.
     50Excluding test tag(s): functional.
     51}}}
Back to Top