[Python-ideas] Making it easy to prepare for PEP479

Andrew Barnert abarnert at yahoo.com
Mon May 18 20:45:30 CEST 2015


On May 18, 2015, at 10:13, Steven D'Aprano <steve at pearwood.info> wrote:
> 
> If Ram is permitted multiple test files, then the simplest 
> solution is to split off the code that relies on the future directive 
> into its own file:
> 
> try:
>    import xyz  # requires the future directive
> except ImportError:
>    xyz = None
> 
> if xyz:
>    # tests with directive
> else:
>    # tests without

Would this break unittest's automated discovery, setuptools' automatic test command, etc., unless you moved xyz out of the tests directory and added a sys.path.import before trying to import it? If so, that might be something worth explaining in a howto or a section of the packaging developer guide.



More information about the Python-ideas mailing list