Skip to content

Commit

Permalink
Fix tests for Python3.
Browse files Browse the repository at this point in the history
  • Loading branch information
musically-ut committed Apr 20, 2015
1 parent 9447d2c commit 798cfe6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions seqfile/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ def test_findNextFile_with_files_non_consecutive_fnamegen():
## Warning: These tests monkey patch the seqfile.seqfile module!
## Hence, these tests must be run last.

import seqfile as _SS

# Monkey patch _doAtomicFileCreation for testing
_SS._oldAtomicCreation = _SS._doAtomicFileCreation
_S._oldAtomicCreation = _S._doAtomicFileCreation
def _testAtomicCreationFactory(folder):

def _testAtomicCreation(filePath):
Expand All @@ -125,15 +123,15 @@ def _testAtomicCreation(filePath):
# Create the file to simulate concurrent file creation
_os.close( _os.open( filePath, _os.O_CREAT | _os.O_EXCL ) )

return _SS._oldAtomicCreation(filePath)
return _S._oldAtomicCreation(filePath)

return _testAtomicCreation


def test_findNextFile_concurrent():
with tempDir() as d:
_SS._doAtomicFileCreation = _testAtomicCreationFactory(d)
_S._doAtomicFileCreation = _testAtomicCreationFactory(d)
# File created must be the second file in the sequence
assert _SS.findNextFile(d, prefix, suffix) == join(d, fnameGen(1))
assert _S.findNextFile(d, prefix, suffix) == join(d, fnameGen(1))


0 comments on commit 798cfe6

Please sign in to comment.