Patchwork [3,of,3,pip-fix] tests: add a test for installing hg with pip in a virtualenv

login
register
mail settings
Submitter Matt Harbison
Date June 7, 2017, 1:31 a.m.
Message ID <op.y1fvukgz9lwrgf@envy>
Download mbox | patch
Permalink /patch/21232/
State Not Applicable
Headers show

Comments

Matt Harbison - June 7, 2017, 1:31 a.m.
On Tue, 06 Jun 2017 14:24:51 -0400, Augie Fackler <raf@durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1496762198 14400
> #      Tue Jun 06 11:16:38 2017 -0400
> # Node ID fed1c1d2fb7a5cb7e72cc882bcea0651551c7758
> # Parent  8d69b4886e678a7bc372097eeb33950592c53d43
> tests: add a test for installing hg with pip in a virtualenv
>
> Since we're doing so much clever junk in our setup.py, let's have a
> test that exercises it.

The change works for Windows, thanks.  But this test doesn't.  I can  
follow up, but basically the path on Windows is "installenv/Scripts/pip"  
instead of ../bin/..  But since that's already in an #if block, I had to  
define variables for pip and hg outside of the block, and spell out the  
b?n part.

($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates/map-cmdline.default)  
(glob)
-  checking commit editor... (*) (glob)
-  checking username (test)
-  no problems detected
+  $TESTTMP.sh: line 82: ./installenv/b?n/hg: No such file or directory
+  New python executable in $TESTTMP\\installenv\\Scripts\\python.exe\r  
(esc)
+  Installing setuptools, pip, wheel...done.\r (esc)
  #endif


> diff --git a/tests/test-install.t b/tests/test-install.t
> --- a/tests/test-install.t
> +++ b/tests/test-install.t
> @@ -173,3 +173,38 @@ path variables are expanded (~ is the sa
>    Not tracked:
> #endif
> +
> +#if virtualenv
> +
> +Verify that Mercurial is installable with pip. Note that this MUST be
> +the last test in this file, because we do some nasty things to the
> +shell environment in order to make the virtualenv work reliably.
> +
> +  $ cd $TESTTMP
> +Note: --no-site-packages is deprecated, but some places have an
> +ancient virtualenv from their linux distro or similar and it's not yet
> +the default for them. :(
> +  $ unset PYTHONPATH
> +  $ $PYTHON -m virtualenv --no-site-packages installenv >> pip.log
> +  $ ./installenv/b?n/pip install $TESTDIR/.. >> pip.log
> +  $ ./installenv/b?n/hg debuginstall || cat pip.log
> +  checking encoding (ascii)...
> +  checking Python executable (*) (glob)
> +  checking Python version (2.*) (glob)
> +  checking Python lib (*)... (glob)
> +  checking Python security support (*) (glob)
> +    TLS 1.2 not supported by Python install; network connections lack  
> modern security (?)
> +    SNI not supported by Python install; may have connectivity issues  
> with some servers (?)
> +  checking Mercurial version (*) (glob)
> +  checking Mercurial custom build (*) (glob)
> +  checking module policy (*) (glob)
> +  checking installed modules (*/mercurial)... (glob)
> +  checking registered compression engines (*) (glob)
> +  checking available compression engines (*) (glob)
> +  checking available compression engines for wire protocol (*) (glob)
> +  checking templates  
> ($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates)...  
> (glob)
> +  checking default template  
> ($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates/map-cmdline.default)  
> (glob)
> +  checking commit editor... (*) (glob)
> +  checking username (test)
> +  no problems detected
> +#endif
Augie Fackler - June 7, 2017, 1:56 p.m.
> On Jun 6, 2017, at 21:31, Matt Harbison <mharbison72@gmail.com> wrote:
> 
> On Tue, 06 Jun 2017 14:24:51 -0400, Augie Fackler <raf@durin42.com> wrote:
> 
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1496762198 14400
>> #      Tue Jun 06 11:16:38 2017 -0400
>> # Node ID fed1c1d2fb7a5cb7e72cc882bcea0651551c7758
>> # Parent  8d69b4886e678a7bc372097eeb33950592c53d43
>> tests: add a test for installing hg with pip in a virtualenv
>> 
>> Since we're doing so much clever junk in our setup.py, let's have a
>> test that exercises it.
> 
> The change works for Windows, thanks.  But this test doesn't.  I can follow up, but basically the path on Windows is "installenv/Scripts/pip" instead of ../bin/..  But since that's already in an #if block, I had to define variables for pip and hg outside of the block, and spell out the b?n part.

Interesting. Should we make it a test-pip-install.t that does #require virtualenv, and then we can conditionalize the command on the OS?

Alternatively, could we get away with doing ./installenv/*/hg debuginstall? would that work?

> --- c:/Users/Matt/projects/hg/tests/test-install.t
> +++ c:/Users/Matt/projects/hg/tests/test-install.t.err
> @@ -187,24 +187,12 @@
>   $ unset PYTHONPATH
>   $ $PYTHON -m virtualenv --no-site-packages installenv >> pip.log
>   $ ./installenv/b?n/pip install $TESTDIR/.. >> pip.log
> +  $TESTTMP.sh: line 80: ./installenv/b?n/pip: No such file or directory
> +  [127]
>   $ ./installenv/b?n/hg debuginstall || cat pip.log
> -  checking encoding (ascii)...
> -  checking Python executable (*) (glob)
> -  checking Python version (2.*) (glob)
> -  checking Python lib (*)... (glob)
> -  checking Python security support (*) (glob)
>     TLS 1.2 not supported by Python install; network connections lack modern security (?)
>     SNI not supported by Python install; may have connectivity issues with some servers (?)
> -  checking Mercurial version (*) (glob)
> -  checking Mercurial custom build (*) (glob)
> -  checking module policy (*) (glob)
> -  checking installed modules (*/mercurial)... (glob)
> -  checking registered compression engines (*) (glob)
> -  checking available compression engines (*) (glob)
> -  checking available compression engines for wire protocol (*) (glob)
> -  checking templates ($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates)... (glob)
> -  checking default template ($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates/map-cmdline.default) (glob)
> -  checking commit editor... (*) (glob)
> -  checking username (test)
> -  no problems detected
> +  $TESTTMP.sh: line 82: ./installenv/b?n/hg: No such file or directory
> +  New python executable in $TESTTMP\\installenv\\Scripts\\python.exe\r (esc)
> +  Installing setuptools, pip, wheel...done.\r (esc)
> #endif
> 
> 
>> diff --git a/tests/test-install.t b/tests/test-install.t
>> --- a/tests/test-install.t
>> +++ b/tests/test-install.t
>> @@ -173,3 +173,38 @@ path variables are expanded (~ is the sa
>>   Not tracked:
>> #endif
>> +
>> +#if virtualenv
>> +
>> +Verify that Mercurial is installable with pip. Note that this MUST be
>> +the last test in this file, because we do some nasty things to the
>> +shell environment in order to make the virtualenv work reliably.
>> +
>> +  $ cd $TESTTMP
>> +Note: --no-site-packages is deprecated, but some places have an
>> +ancient virtualenv from their linux distro or similar and it's not yet
>> +the default for them. :(
>> +  $ unset PYTHONPATH
>> +  $ $PYTHON -m virtualenv --no-site-packages installenv >> pip.log
>> +  $ ./installenv/b?n/pip install $TESTDIR/.. >> pip.log
>> +  $ ./installenv/b?n/hg debuginstall || cat pip.log
>> +  checking encoding (ascii)...
>> +  checking Python executable (*) (glob)
>> +  checking Python version (2.*) (glob)
>> +  checking Python lib (*)... (glob)
>> +  checking Python security support (*) (glob)
>> +    TLS 1.2 not supported by Python install; network connections lack modern security (?)
>> +    SNI not supported by Python install; may have connectivity issues with some servers (?)
>> +  checking Mercurial version (*) (glob)
>> +  checking Mercurial custom build (*) (glob)
>> +  checking module policy (*) (glob)
>> +  checking installed modules (*/mercurial)... (glob)
>> +  checking registered compression engines (*) (glob)
>> +  checking available compression engines (*) (glob)
>> +  checking available compression engines for wire protocol (*) (glob)
>> +  checking templates ($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates)... (glob)
>> +  checking default template ($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates/map-cmdline.default) (glob)
>> +  checking commit editor... (*) (glob)
>> +  checking username (test)
>> +  no problems detected
>> +#endif

Patch

--- c:/Users/Matt/projects/hg/tests/test-install.t
+++ c:/Users/Matt/projects/hg/tests/test-install.t.err
@@ -187,24 +187,12 @@ 
    $ unset PYTHONPATH
    $ $PYTHON -m virtualenv --no-site-packages installenv >> pip.log
    $ ./installenv/b?n/pip install $TESTDIR/.. >> pip.log
+  $TESTTMP.sh: line 80: ./installenv/b?n/pip: No such file or directory
+  [127]
    $ ./installenv/b?n/hg debuginstall || cat pip.log
-  checking encoding (ascii)...
-  checking Python executable (*) (glob)
-  checking Python version (2.*) (glob)
-  checking Python lib (*)... (glob)
-  checking Python security support (*) (glob)
      TLS 1.2 not supported by Python install; network connections lack  
modern security (?)
      SNI not supported by Python install; may have connectivity issues  
with some servers (?)
-  checking Mercurial version (*) (glob)
-  checking Mercurial custom build (*) (glob)
-  checking module policy (*) (glob)
-  checking installed modules (*/mercurial)... (glob)
-  checking registered compression engines (*) (glob)
-  checking available compression engines (*) (glob)
-  checking available compression engines for wire protocol (*) (glob)
-  checking templates  
($TESTTMP/installenv/lib*/python2.7/site-packages/mercurial/templates)...  
(glob)
-  checking default template