Skip to content

Commit

Permalink
Fix tests failing when the environment causes getlogin to fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikkelSchubert committed Apr 28, 2017
1 parent 08c8fc0 commit 249e688
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
subset of strings were allowed. These now result in a proper MakeFileError.
- Fixed user options in the 'BWA' section of the BAM Pipeline makefiles not
being correctly applied when using the 'mem' or the 'bwasw' algorithms.
- Fixed some unit tests failing when the environment caused getlogin to fail.


## [1.2.7] - 2017-01-03
Expand Down
6 changes: 4 additions & 2 deletions paleomix/common/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# SOFTWARE.
#
import os
import pwd
import sys
import shutil
import tempfile
Expand All @@ -46,8 +47,9 @@ def with_temp_folder(func):
Creates a unique temporary folder before running 'func'. The
function is is assumed to take at least one parameter, the first
of which is assumed to represent the temporary folder."""
temp_root = os.path.join(tempfile.gettempdir(), os.getlogin())
make_dirs(temp_root) # Ensure that this subdirectory exists
name = pwd.getpwuid(os.geteuid()).pw_name
temp_root = os.path.join(tempfile.gettempdir(), name)
make_dirs(temp_root)

@nose.tools.istest
def _wrapper(*args, **kwargs):
Expand Down

0 comments on commit 249e688

Please sign in to comment.