Skip to content

MNT: Replace distutils with setuptools in wcs extension test#10581

Merged
embray merged 2 commits intoastropy:mainfrom
pllim:distutils-wcs-ext-test
Jun 29, 2021
Merged

MNT: Replace distutils with setuptools in wcs extension test#10581
embray merged 2 commits intoastropy:mainfrom
pllim:distutils-wcs-ext-test

Conversation

@pllim
Copy link
Member

@pllim pllim commented Jul 17, 2020

Description

This has been resolved.

This will fail. Not sure how to fix.

____________________________ test_wcsapi_extension _____________________________
[gw0] linux -- Python 3.6.11 /root/project/.tox/py36-test/bin/python

tmpdir = local('/tmp/pytest-of-root/pytest-0/popen-gw0/test_wcsapi_extension0')

    def test_wcsapi_extension(tmpdir):
        # ...

        code = """
        import sys
        import wcsapi_test
        sys.exit(wcsapi_test.test())
        """
    
        code = code.strip().replace('\n', '; ')
    
        # Import and run the extension
>       subprocess.check_call([sys.executable, '-c', code], env=env)

../../.tox/py36-test/lib/python3.6/site-packages/astropy/wcs/tests/extension/test_extension.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['/root/project/.tox/py36-test/bin/python', '-c', 'import sys;     import wcsapi_test;     sys.exit(wcsapi_test.test())'],)
kwargs = {'env': {'CI': 'true', 'HOME': '/root', 'LANG': 'en_US.UTF-8', 'LANGUAGE': 'en_US.UTF-8', ...}}
retcode = 1
cmd = ['/root/project/.tox/py36-test/bin/python', '-c', 'import sys;     import wcsapi_test;     sys.exit(wcsapi_test.test())']

    def check_call(*popenargs, **kwargs):
        # ...
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['/root/project/.tox/py36-test/bin/python', '-c', 'import sys;     import wcsapi_test;     sys.exit(wcsapi_test.test())']' returned non-zero exit status 1.

/opt/python/cp36-cp36m/lib/python3.6/subprocess.py:311: CalledProcessError
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'wcsapi_test'

This is a direct follow-up of #10571 .

@pllim pllim added this to the v4.0.2 milestone Jul 17, 2020
@astropy-bot astropy-bot bot added the wcs label Jul 17, 2020
@astrofrog astrofrog modified the milestones: v4.0.2, v4.0.3, v4.0.4 Oct 10, 2020
@bsipocz bsipocz modified the milestones: v4.0.4, v4.0.5 Nov 25, 2020
@eteq eteq modified the milestones: v4.0.5, v4.0.6 Mar 18, 2021
@embray
Copy link
Member

embray commented Jun 21, 2021

I'll take a look at it. Weird that this would fail.

pllim and others added 2 commits June 21, 2021 11:03
It still calls setup.py directly, but with the right flags needed by
setuptools to invoke "distutils-like" installation, rather than
setuptools' legacy default behavior of building and installing an EGG.

In the future we might want to change this to a more "modern" Python
package and build/install with pip, though for building extension
modules with setuptools, writing a setup.py is still the best way.

Also removed the awkward bit where the astropy path was passed to
setup.py as an extra command-line argument.  Setting PYTHONPATH is
good-enough for this.
@embray embray force-pushed the distutils-wcs-ext-test branch from 694cae9 to d2cf590 Compare June 21, 2021 09:32
@embray embray marked this pull request as ready for review June 21, 2021 09:32
@embray
Copy link
Member

embray commented Jun 21, 2021

@pllim I updated your PR: It should be working now.

@pllim pllim modified the milestones: v4.0.6, v4.3.1 Jun 21, 2021
@pllim
Copy link
Member Author

pllim commented Jun 21, 2021

Wow, you work magic, @embray !

p.s. I updated the milestone because looks like #10571's got moved too.

@pllim pllim requested review from mcara and nden June 21, 2021 13:56
@embray embray merged commit 00b7498 into astropy:main Jun 29, 2021
@pllim pllim deleted the distutils-wcs-ext-test branch June 29, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants