Patchwork [hglib,V2] tests: handle the removal of `obsolete._enabled` in Mercurial

login
register
mail settings
Submitter Matt Harbison
Date May 22, 2019, 1:47 a.m.
Message ID <19b12f3e7cc79566c4bb.1558489658@Envy>
Download mbox | patch
Permalink /patch/40179/
State Superseded
Headers show

Comments

Matt Harbison - May 22, 2019, 1:47 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1557281819 14400
#      Tue May 07 22:16:59 2019 -0400
# Node ID 19b12f3e7cc79566c4bb7d1c8df4a6d50d88133d
# Parent  33b512aa8dba0cbe523188fbb62d30ae2125a236
tests: handle the removal of `obsolete._enabled` in Mercurial

I'm not sure why we can't just set `experimental.evolution=all`, but it didn't
work.
Yuya Nishihara - May 22, 2019, 11:23 p.m.
On Tue, 21 May 2019 21:47:38 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1557281819 14400
> #      Tue May 07 22:16:59 2019 -0400
> # Node ID 19b12f3e7cc79566c4bb7d1c8df4a6d50d88133d
> # Parent  33b512aa8dba0cbe523188fbb62d30ae2125a236
> tests: handle the removal of `obsolete._enabled` in Mercurial
> 
> I'm not sure why we can't just set `experimental.evolution=all`, but it didn't
> work.
> 
> diff --git a/tests/test-hidden.py b/tests/test-hidden.py
> --- a/tests/test-hidden.py
> +++ b/tests/test-hidden.py
> @@ -22,7 +22,10 @@
>          super(test_obsolete_baselib, self).setUp()
>          self.append('.hg/obs.py',
>                      "import mercurial.obsolete\n"
> -                    "mercurial.obsolete._enabled = True")
> +                    "try:\n"
> +                    "    mercurial.obsolete.isenabled = lambda r, opt: True\n"
> +                    "except AttributeError:\n"
> +                    "    mercurial.obsolete._enabled = True")

I don't think AttributeError would be raised. Maybe just do both?
Matt Harbison - May 23, 2019, 1:29 a.m.
On Wed, 22 May 2019 19:23:41 -0400, Yuya Nishihara <yuya@tcha.org> wrote:

> On Tue, 21 May 2019 21:47:38 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1557281819 14400
>> #      Tue May 07 22:16:59 2019 -0400
>> # Node ID 19b12f3e7cc79566c4bb7d1c8df4a6d50d88133d
>> # Parent  33b512aa8dba0cbe523188fbb62d30ae2125a236
>> tests: handle the removal of `obsolete._enabled` in Mercurial
>>
>> I'm not sure why we can't just set `experimental.evolution=all`, but it  
>> didn't
>> work.
>>
>> diff --git a/tests/test-hidden.py b/tests/test-hidden.py
>> --- a/tests/test-hidden.py
>> +++ b/tests/test-hidden.py
>> @@ -22,7 +22,10 @@
>>          super(test_obsolete_baselib, self).setUp()
>>          self.append('.hg/obs.py',
>>                      "import mercurial.obsolete\n"
>> -                    "mercurial.obsolete._enabled = True")
>> +                    "try:\n"
>> +                    "    mercurial.obsolete.isenabled = lambda r, opt:  
>> True\n"
>> +                    "except AttributeError:\n"
>> +                    "    mercurial.obsolete._enabled = True")
>
> I don't think AttributeError would be raised. Maybe just do both?

You're right.  I ran the test with the try and except blocks swapped and  
it also worked, so I thought it did raise.  But it wasn't running against  
default, so changing either would have worked.

Patch

diff --git a/tests/test-hidden.py b/tests/test-hidden.py
--- a/tests/test-hidden.py
+++ b/tests/test-hidden.py
@@ -22,7 +22,10 @@ 
         super(test_obsolete_baselib, self).setUp()
         self.append('.hg/obs.py',
                     "import mercurial.obsolete\n"
-                    "mercurial.obsolete._enabled = True")
+                    "try:\n"
+                    "    mercurial.obsolete.isenabled = lambda r, opt: True\n"
+                    "except AttributeError:\n"
+                    "    mercurial.obsolete._enabled = True")
         self.append('.hg/hgrc','\n[extensions]\nobs=.hg/obs.py')
 
 class test_obsolete_client(test_obsolete_baselib):