Tests shouldn't conflict / mess up user's directory

Issue #129 new
andrew_peterson repo owner created an issue

Right now, if you type nosetests inside your amp directory, the tests run. This is nice. However, the tests produce a lot of garbage files right inside the directory. This is not nice. Also, if we are not careful, as developers we could end up with name conflicts with some of the files created in our tests.

There are a couple of ways we could consider fixing this:

  • Require that any files created by tests use the tempfile.mkdtemp function. This will make the output of each go somewhere like /tmp/tmp7M_ZK1. This would prevent conflicts. A disadvantage is that it might be harder to trace things when nightly builds fail, but we can maybe circumvent this by using the prefix keyword of mkdtemp? (This allows you to specify the location and an identifying name before the random characters come in.)

  • Look at how ASE does it now. You run with python -m ase.test, which lets them customize everything just how they want it. Although that might be overkill for us ... keeping the standard way like nosetests is nice.

Comments (1)

  1. Muammar El Khatib

    The Makefile used to create a hardcoded /tmp/amptests directory where the output coming from the tests was stored. Then, there was a regression in aca2715e8e0068b4d8ac05185f0c944fd04dcfa8. I think the first proposal by Andy sounds easy to implement and still is effective.

    I checked inside ase/test and doing something like they do here seems very elegant but would require more work that might not be justified given the type of tests we perform for Amp.

  2. Log in to comment