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 unittest
7import yaml
8from fundamentals.utKit import utKit
9from fundamentals import tools
10from os.path import expanduser
11home = expanduser("~")
13packageDirectory = utKit("").get_project_root()
14settingsFile = packageDirectory + "/test_settings.yaml"
15# settingsFile = home + "/.config/soxspipe.recipes/soxspipe.recipes.yaml"
16su = tools(
17 arguments={"settingsFile": settingsFile},
18 docString=__doc__,
19 logLevel="DEBUG",
20 options_first=False,
21 projectName=None,
22 defaultSettingsFile=False
23)
24arguments, settings, log, dbConn = su.setup()
26# SETUP AND TEARDOWN FIXTURE FUNCTIONS FOR THE ENTIRE MODULE
27moduleDirectory = os.path.dirname(__file__)
28utKit = utKit(moduleDirectory)
29log, dbConn, pathToInputDir, pathToOutputDir = utKit.setupModule()
30utKit.tearDownModule()
32try:
33 shutil.rmtree(pathToOutputDir)
34except:
35 pass
36# COPY INPUT TO OUTPUT DIR
37shutil.copytree(pathToInputDir, pathToOutputDir)
39# Recursively create missing directories
40if not os.path.exists(pathToOutputDir):
41 os.makedirs(pathToOutputDir)
43# xt-setup-unit-testing-files-and-folders
45class test_tag(unittest.TestCase):
47 def test_tag_function(self):
49 from fundamentals.files.tag import tag
50 tag(
51 log=log,
52 filepath=pathToOutputDir + "/file_needing_tagged.dat",
53 tags="test,tags, fundamentals",
54 rating=3,
55 wherefrom="http://www.thespacedoctor.co.uk"
56 )
58 def test_tag_function_exception(self):
60 from fundamentals.files import tag
61 try:
62 this = tag(
63 log=log,
64 fakeKey="break the code"
65 )
66 assert False
67 except Exception as e:
68 assert True
69 print(str(e))
71 # x-print-testpage-for-pessto-marshall-web-object
73 # x-class-to-test-named-worker-function