Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from __future__ import print_function 

2from builtins import str 

3import os 

4import unittest 

5import shutil 

6import yaml 

7from khufu.utKit import utKit 

8from fundamentals import tools 

9from os.path import expanduser 

10home = expanduser("~") 

11 

12packageDirectory = utKit("").get_project_root() 

13settingsFile = packageDirectory + "/test_settings.yaml" 

14 

15su = tools( 

16 arguments={"settingsFile": settingsFile}, 

17 docString=__doc__, 

18 logLevel="DEBUG", 

19 options_first=False, 

20 projectName=None, 

21 defaultSettingsFile=False 

22) 

23arguments, settings, log, dbConn = su.setup() 

24 

25# SETUP PATHS TO COMMON DIRECTORIES FOR TEST DATA 

26moduleDirectory = os.path.dirname(__file__) 

27pathToInputDir = moduleDirectory + "/input/" 

28pathToOutputDir = moduleDirectory + "/output/" 

29 

30try: 

31 shutil.rmtree(pathToOutputDir) 

32except: 

33 pass 

34# COPY INPUT TO OUTPUT DIR 

35shutil.copytree(pathToInputDir, pathToOutputDir) 

36 

37# Recursively create missing directories 

38if not os.path.exists(pathToOutputDir): 

39 os.makedirs(pathToOutputDir) 

40 

41# SETUP AND TEARDOWN FIXTURE FUNCTIONS FOR THE ENTIRE MODULE 

42def setUpModule(): 

43 "set up test fixtures" 

44 moduleDirectory = os.path.dirname(__file__) 

45 

46 # SETUP PATHS TO COMMONG DIRECTORIES FOR TEST DATA 

47 global pathToInputDataDir, pathToOutputDir, pathToOutputDataDir 

48 pathToInputDataDir = moduleDirectory + "/input/data/" 

49 pathToOutputDir = moduleDirectory + "/output/" 

50 pathToOutputDataDir = pathToOutputDir + "data/" 

51 

52 # SETUP THE TEST LOG FILE 

53 global testlog 

54 testlog = open(pathToOutputDir + "tests.log", 'w') 

55 

56 return None 

57 

58def tearDownModule(): 

59 "tear down test fixtures" 

60 # CLOSE THE TEST LOG FILE 

61 testlog.close() 

62 return None 

63 

64# SETUP AND TEARDOWN FIXTURE FUNCTIONS 

65def setUpFunc(): 

66 "set up the test fixtures" 

67 

68 return None 

69 

70def tearDownFunc(): 

71 "tear down the test fixtures" 

72 

73 return None