Problem while integrating unittest with setuptools

YuXuan Dong yuxuan.dong at outlook.com
Mon Sep 2 05:28:21 EDT 2019


Thank you. It helps.

I have uninstalled `six` using `pip uninstall six` but the problem is still there.

As you suggested, I have checked the traceback and found the exception is caused by `/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/test/test_winreg.py` on my machine with homebrew-installed Python3.

I have realized that the problem may be caused of `test-suite=test` in my `setup.py`. `setuptools` will find the `test` package. But the package it found is not in my project. It found `/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/test`.

To verify my guess, I renamed the `test` folder in the above folder. As expected, another exception is raised.

The problem now is that, how could I config my `setup.py` to work properly?

On 2019/9/2, 13:07, "Python-list on behalf of dieter" <python-list-bounces+yuxuan.dong=outlook.com at python.org on behalf of dieter at handshake.de> wrote:

    YuXuan Dong <yuxuan.dong at outlook.com> writes:
    > I met a problem while I ran `python setup.py test`: 
    >
    > 	unittest.case.SkipTest: No module named 'winreg'
    > ... no windows modules should be necessary ...
    
    I know apparently unexplainable "no module named ..." messages as
    a side effect of the use of "six".
    
    "six" is used to facilitate the development of components usable
    for both Python 2 and Python 3. Among others, it contains the
    module "six.moves" which uses advance Python features to allow
    the import of Python modules from different locations in the
    package hierarchy and also handles name changes. This can
    confuse other components using introspection (they see
    modules in "six.move" which are not really available).
    
    To find out if something like this is the cause of your problem,
    please try to get a traceback. It might be necessary to
    use a different test runner for this (I like much "zope.testrunner"
    and my wrapper "dm.zopepatches.ztest").
    
    -- 
    https://mail.python.org/mailman/listinfo/python-list
    




More information about the Python-list mailing list