Skip to content
  • Matt Harbison's avatar
    tests: update test-util.py for modern attrs package · 7e6f3c69c0fb
    Matt Harbison authored
    When updating to 22.1.0, this test started failing:
    
        Traceback (most recent call last):
          File "/tmp/mercurial-ci/tests/test-util.py", line 53, in <module>
            _start_default = (util.timedcmstats.start.default, 'factory')
        AttributeError: type object 'timedcmstats' has no attribute 'start'
    
    Poking around in `hg debugshell`, the attribute is indeed missing, but looks to
    be attached to `__attrs_attrs__` in both the currently vendored and the modern
    version of attrs.  The old attrs packages will print the same for both accesses,
    so fingers crossed...
    
        >>> print((util.timedcmstats.start.default, 'factory'))
        (Factory(factory=<function timedcmstats.<lambda> at 0x000001EFDF0F21F0>, takes_self=False), 'factory')
    
        >>> print((util.timedcmstats.__attrs_attrs__.start.default, 'factory'))
        (Factory(factory=<function timedcmstats.<lambda> at 0x000001EFDF0F21F0>, takes_self=False), 'factory')
    7e6f3c69c0fb