Skip to content

Commit

Permalink
Move link tests into its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
Guiral Michaël committed Nov 7, 2016
1 parent d1d308a commit 505cb91
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 19 deletions.
50 changes: 50 additions & 0 deletions test/pyTest/testLink.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import time
import tempfile
import os
import shutil

from pySequenceParser import sequenceParser as seq
from . import createFile, createFolder, getSequencesFromPath

from nose.tools import *

root_path = ''

def setUp():
global root_path
root_path = tempfile.mkdtemp()

# create files
files_to_create = [
"plop.txt"
]
for f in files_to_create:
createFile(root_path, f)

# create folder
createFolder(root_path, "dir1")

# create sym link
os.symlink(os.path.join(root_path, "plop.txt"), os.path.join(root_path, "plop_sym_link.txt"))
os.symlink(os.path.join(root_path, "dir1"), os.path.join(root_path, "dir2"))

def tearDown():
global root_path
shutil.rmtree(root_path)

def testLinkType():
"""
Check stats of a synbolic link folder.
- 2 hard links (. and ..)
- sizes
"""
print("testFolderLinkStat:")
print("===================")
items = seq.browse(root_path)
for item in items:
if item.getFilename() in ("plop_sym_link.txt", "dir2"):
assert_equals(item.getType(), seq.eTypeLink)
elif item.getFilename() == "plop.txt":
assert_equals(item.getType(), seq.eTypeFile)
elif item.getFilename() == "dir1":
assert_equals(item.getType(), seq.eTypeFolder)
19 changes: 0 additions & 19 deletions test/pyTest/testStat.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,6 @@ def testFolderStat():
#assert_equals(itemStat.realSize, itemStat.size) # 0L != -1L
assert_greater_equal(itemStat.sizeOnDisk, itemStat.size)

def testFolderLinkStat():
"""
Check stats of a synbolic link folder.
- 2 hard links (. and ..)
- sizes
"""
print("testFolderLinkStat:")
print("===================")
items = seq.browse(root_path)
for item in items:
if item.getFilename() in ("plop_sym_link.txt", "dir2"):
assert_equals(item.getType(), seq.eTypeLink)
elif item.getFilename() == "plop.txt":
assert_equals(item.getType(), seq.eTypeFile)
elif item.getFilename() == "foo.###.png":
assert_equals(item.getType(), seq.eTypeSequence)
elif item.getFilename() == "dir1":
assert_equals(item.getType(), seq.eTypeFolder)

def testSequenceStat():
"""
Check stats of a sequence.
Expand Down

0 comments on commit 505cb91

Please sign in to comment.