Example #1
0
    def test_Logging_Basic_002_01(self):
        """Test if options can be modified from MythTV.MythLog."""

        m = MythLog('simple_test')

        m._setmask("most")
        # check the modified mask:
        self.assertEqual(m._MASK, LOGMASK.MOST)
        # check the default level:
        self.assertEqual(m._LEVEL, LOGLEVEL.INFO)
        # check the default file:
        self.assertTrue('stdout' in repr(m._LOGFILE))

        m._setlevel("notice")
        # check the modified mask:
        self.assertEqual(m._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(m._LEVEL, LOGLEVEL.NOTICE)
        # check the default file:
        self.assertTrue('stdout' in repr(m._LOGFILE))

        m._setfile("/tmp/my_logfile")
        # check the modified mask:
        self.assertEqual(m._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(m._LEVEL, LOGLEVEL.NOTICE)
        # check the modified file:
        self.assertTrue(os.path.exists("/tmp/my_logfile"))
Example #2
0
    def test_Logging_Basic_004_01(self):
        """"Test if setting options works without a MythLog instance."""

        MythLog._setmask("most")
        # check the modified mask:
        self.assertEqual(MythLog._MASK, LOGMASK.MOST)
        # check the default level:
        self.assertEqual(MythLog._LEVEL, LOGLEVEL.INFO)
        # check the default file:
        self.assertTrue('stdout' in repr(MythLog._LOGFILE))

        MythLog._setlevel("notice")
        # check the modified mask:
        self.assertEqual(MythLog._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(MythLog._LEVEL, LOGLEVEL.NOTICE)
        # check the default file:
        self.assertTrue('stdout' in repr(MythLog._LOGFILE))

        MythLog._setfile("/tmp/my_logfile")
        # check the modified mask:
        self.assertEqual(MythLog._MASK, LOGMASK.MOST)
        # check the modified level:
        self.assertEqual(MythLog._LEVEL, LOGLEVEL.NOTICE)
        # check the modified file:
        self.assertTrue(os.path.exists("/tmp/my_logfile"))
Example #3
0
def run_debug():
    MythLog._setfile('/var/log/mythtv/mythfs.log')
    MythLog._setlevel('important,general,file')
    fs = DebugFS()
    fs.fsinit()
    banner = 'MythTV Python interactive shell.'
    import code
    try:
        import readline, rlcompleter
    except:
        pass
    else:
        readline.parse_and_bind("tab: complete")
        banner += ' TAB completion available.'
    namespace = globals().copy()
    namespace.update(locals())
    code.InteractiveConsole(namespace).interact(banner)
    sys.exit()
Example #4
0
def run_debug():
    MythLog._setfile('/var/log/mythtv/mythfs.log')
    MythLog._setlevel('important,general,file')
    fs = DebugFS()
    fs.fsinit()
    banner = 'MythTV Python interactive shell.'
    import code
    try:
        import readline, rlcompleter
    except:
        pass
    else:
        readline.parse_and_bind("tab: complete")
        banner += ' TAB completion available.'
    namespace = globals().copy()
    namespace.update(locals())
    code.InteractiveConsole(namespace).interact(banner)
    sys.exit()
Example #5
0
try:
    import MythTV
except:
    print 'Warning! MythTV Python bindings could not be found'
    sys.exit(1)
if MythTV.__version__ < (0,24,0,0):
    print 'Warning! Installed MythTV Python bindings are tool old. Please update'
    print '    to 0.23.0.18 or later.'
    sys.exit(1)
from MythTV import MythDB, MythVideo, ftopen, MythBE,\
                   Video, Recorded, MythLog, static

fuse.fuse_python_api = (0, 2)
LOG = MythLog(lstr='none')
MythLog._setfile('/dev/null')
BACKEND = None

def doNothing(*args, **kwargs):
    pass

def increment():
    res = 1
    while True:
        yield res
        res += 1

class Attr(fuse.Stat):
    def __init__(self):
        self.st_mode = 0
        self.st_ino = 0
Example #6
0
try:
    import MythTV
except:
    print 'Warning! MythTV Python bindings could not be found'
    sys.exit(1)
if MythTV.__version__ < (0, 24, 0, 0):
    print 'Warning! Installed MythTV Python bindings are tool old. Please update'
    print '    to 0.23.0.18 or later.'
    sys.exit(1)
from MythTV import MythDB, MythVideo, ftopen, MythBE,\
                   Video, Recorded, MythLog, static

fuse.fuse_python_api = (0, 2)
LOG = MythLog(lstr='none')
MythLog._setfile('/dev/null')
BACKEND = None


def doNothing(*args, **kwargs):
    pass


def increment():
    res = 1
    while True:
        yield res
        res += 1


class Attr(fuse.Stat):