Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-19 Thread eryk sun
On 2/16/19, Richard Levasseur wrote: > > First: The tempfile module is a poor fit for testing (don't get me wrong, > it works, but its not *nice for use in tests*)*.* This is because: > 1. Using it as a context manager is distracting. The indentation signifies > a conceptual scope the reader needs

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-16 Thread Richard Levasseur
On Fri, Feb 15, 2019 at 10:02 AM Zachary Ware wrote: > On Fri, Feb 15, 2019 at 11:44 AM Steve Dower > wrote: > > That said, I'd love to have a context manager that we can use to make > > this easier. Really, none of us should be having to decide "how am I > > going to use a temporary location on

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-15 Thread Zachary Ware
On Fri, Feb 15, 2019 at 11:44 AM Steve Dower wrote: > That said, I'd love to have a context manager that we can use to make > this easier. Really, none of us should be having to decide "how am I > going to use a temporary location on the file system in my test", > because we should have one obviou

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-15 Thread Steve Dower
On 14Feb.2019 0948, Brett Cannon wrote: > On Thu, Feb 14, 2019 at 7:26 AM Giampaolo Rodola' > wrote: > Extra: an argument in favor of using tempfile.mkdtemp() instead of > TESTFN is parallel testing, but I think we're not using it. > > > With -j you can do para

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-15 Thread Giampaolo Rodola'
On Thu, Feb 14, 2019 at 6:48 PM Brett Cannon wrote: > > With -j you can do parallel testing and I know I always run with that on. > But TESTFN does *attempt *to account for that > >

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Brett Cannon
On Thu, Feb 14, 2019 at 7:26 AM Giampaolo Rodola' wrote: > > > On Thu, Feb 14, 2019 at 4:03 PM Tim Golden wrote: > >> On 14/02/2019 14:56, Giampaolo Rodola' wrote: >> > >> > >> > On Thu, Feb 14, 2019 at 3:25 PM Eric Snow > > > wrote: >> > >> > On Thu, Feb

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Joni Orponen
On Thu, Feb 14, 2019 at 10:49 AM Ronald Oussoren via Python-Dev < python-dev@python.org> wrote: > I usually use shutil.rmtree for tests that need to create temporary files, > and create a temporary directory for those files (that is, use > tempfile.mkdtemp in setUp() and use shutil.rmtree in tearD

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Tim Golden
On 14/02/2019 15:24, Giampaolo Rodola' wrote: On Thu, Feb 14, 2019 at 4:03 PM Tim Golden > wrote: On 14/02/2019 14:56, Giampaolo Rodola' wrote: > > > On Thu, Feb 14, 2019 at 3:25 PM Eric Snow mailto:ericsnowcurren...@gmail.com> >

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Giampaolo Rodola'
On Thu, Feb 14, 2019 at 4:03 PM Tim Golden wrote: > On 14/02/2019 14:56, Giampaolo Rodola' wrote: > > > > > > On Thu, Feb 14, 2019 at 3:25 PM Eric Snow > > wrote: > > > > On Thu, Feb 14, 2019, 02:47 Ronald Oussoren via Python-Dev > > mailto:python-dev@

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Tim Golden
On 14/02/2019 14:56, Giampaolo Rodola' wrote: On Thu, Feb 14, 2019 at 3:25 PM Eric Snow > wrote: On Thu, Feb 14, 2019, 02:47 Ronald Oussoren via Python-Dev mailto:python-dev@python.org> wrote: I usually use shutil.rmtree for tests that nee

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Giampaolo Rodola'
On Thu, Feb 14, 2019 at 3:25 PM Eric Snow wrote: > On Thu, Feb 14, 2019, 02:47 Ronald Oussoren via Python-Dev < > python-dev@python.org wrote: > >> >> I usually use shutil.rmtree for tests that need to create temporary >> files, and create a temporary directory for those files (that is, use >> te

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Eric Snow
On Thu, Feb 14, 2019, 02:47 Ronald Oussoren via Python-Dev < python-dev@python.org wrote: > > I usually use shutil.rmtree for tests that need to create temporary files, > and create a temporary directory for those files (that is, use > tempfile.mkdtemp in setUp() and use shutil.rmtree in tearDown(

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-14 Thread Ronald Oussoren via Python-Dev
— Twitter: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ > On 13 Feb 2019, at 16:10, Giampaolo Rodola' wrote: > > > > On Wed, Feb 13, 2019 at 2:27 PM Ronald Oussoren > wrote: > > >> On 13 Feb 2019, at 13:24, Giampaolo Rodola' >

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-13 Thread Giampaolo Rodola'
On Wed, Feb 13, 2019 at 2:32 PM Victor Stinner wrote: > Bikeshedding: I suggest to remove "safe_" from the name, it's hard to > guarantee that removal is "safe", especially on Windows where a > removal can be blocked for many reasons. > > Victor > Agree. I actually meant "rmpath()" (which I used

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-13 Thread Giampaolo Rodola'
On Wed, Feb 13, 2019 at 2:27 PM Ronald Oussoren wrote: > > > On 13 Feb 2019, at 13:24, Giampaolo Rodola' wrote: > > > Hello, > after discovering os.makedirs() has no unit-tests ( > https://bugs.python.org/issue35982) I was thinking about working on a PR > to increase the test coverage of fs-rela

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-13 Thread Victor Stinner
Bikeshedding: I suggest to remove "safe_" from the name, it's hard to guarantee that removal is "safe", especially on Windows where a removal can be blocked for many reasons. Victor Le mer. 13 févr. 2019 à 13:28, Giampaolo Rodola' a écrit : > > > Hello, > after discovering os.makedirs() has no u

Re: [Python-Dev] Adding test.support.safe_rmpath()

2019-02-13 Thread Ronald Oussoren via Python-Dev
> On 13 Feb 2019, at 13:24, Giampaolo Rodola' wrote: > > > Hello, > after discovering os.makedirs() has no unit-tests > (https://bugs.python.org/issue35982 ) I > was thinking about working on a PR to increase the test coverage of > fs-related os.* functio

[Python-Dev] Adding test.support.safe_rmpath()

2019-02-13 Thread Giampaolo Rodola'
Hello, after discovering os.makedirs() has no unit-tests ( https://bugs.python.org/issue35982) I was thinking about working on a PR to increase the test coverage of fs-related os.* functions. In order to do so I think it would be useful to add a convenience function to "just delete something if it