"""
    See the file "LICENSE" for the full license governing this code. 
    Copyright 2011,2012,2013 Ken Farmer
"""

import sys
import os
import tempfile
import random
import csv
import pytest
from pprint import pprint as pp

import test_tools

mod = test_tools.load_script('gristle_freaker')



# shut off the printing of warnings & info statements from module
old_stdout = sys.stdout
old_stderr = sys.stderr
null       = open(os.devnull, 'wb')
sys.stdout = sys.stderr = null




class Test_build_freq(object):

    def setup_method(self, method):
Beispiel #2
0
import sys
import os
import time
import tempfile
import random
import csv
import pytest
from pprint import pprint as pp

import test_tools

sys.path.append('../../../../')
#sys.path.append('/home/kenfar/Projects/datagristle_file_doer/lib/python2.7/site-packages')
sys.path.append(
    '/home/kenfar/Projects/datagristle_file_doer/lib/python2.7/site-packages')
mod = test_tools.load_script('gristle_processor')

# shut off the printing of warnings & info statements from module
#old_stdout = sys.stdout
#old_stderr = sys.stderr
#null       = open(os.devnull, 'wb')
#sys.stdout = sys.stderr = null


class Test_ProcessDir(object):
    def setup_method(self, method):
        self.tmpdir = tempfile.mkdtemp(prefix="gristle_processor_")
        for i in range(100):
            suffix = '_2013-03-10_'
            create_file(self, age=None, suffix=suffix, mydir=self.tmpdir)
"""
    See the file "LICENSE" for the full license governing this code. 
    Copyright 2011,2012,2013 Ken Farmer
"""

import sys
import os
import tempfile
import random
import csv
import pytest
from pprint import pprint as pp

import test_tools

mod = test_tools.load_script('gristle_freaker')

# shut off the printing of warnings & info statements from module
old_stdout = sys.stdout
old_stderr = sys.stderr
null = open(os.devnull, 'wb')
sys.stdout = sys.stderr = null


def generate_col_freaker_dependencies():
    dialect = csv.Dialect
    dialect.delimiter = '|'
    dialect.quoting = True
    dialect.quotechar = '"'
    dialect.has_header = False
    dialect.lineterminator = '\n'
"""
   See the file "LICENSE" for the full license governing this code. 
   Copyright 2011,2012,2013 Ken Farmer
"""

import sys
import os
import tempfile
import random
import csv
import optparse
import pytest
from pprint import pprint as pp
import test_tools

mod = test_tools.load_script('gristle_file_converter')




class TestOptsAndArgs(object):

   def _run_check(self, sysarg, expected_result):
       sys.argv       = sysarg
       cmd_parser     = None
       opts           = None
       files          = None
       if expected_result == 'SystemExit':
           with pytest.raises(SystemExit):
               cmd_parser = mod.CommandLineParser()
               opts       = cmd_parser.opts
#!/usr/bin/env python
"""
    See the file "LICENSE" for the full license governing this code. 
    Copyright 2011,2012,2013 Ken Farmer
"""

import sys
import os
import tempfile
import random
import unittest
import csv
from pprint import pprint as pp
import test_tools

mod = test_tools.load_script("gristle_freaker")


# shut off the printing of warnings & info statements from module
old_stdout = sys.stdout
old_stderr = sys.stderr
null = open(os.devnull, "wb")
sys.stdout = sys.stderr = null


def suite():

    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(Test_ColumnLengthTracker))
    suite.addTest(unittest.makeSuite(Test_create_key))
    suite.addTest(unittest.makeSuite(Test_create_output_row))
Beispiel #6
0
"""
   See the file "LICENSE" for the full license governing this code. 
   Copyright 2011,2012,2013 Ken Farmer
"""


import sys
import os
import tempfile
import random
import unittest
import csv
import optparse
from pprint import pprint as pp
import test_tools
mod = test_tools.load_script('gristle_file_converter')


def suite():

    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestOptsAndArgs))
    unittest.TextTestRunner(verbosity=2).run(suite)

    return suite




class TestOptsAndArgs(unittest.TestCase):
Beispiel #7
0
import sys
import os
import time
import tempfile
import random
import csv
import pytest
from pprint import pprint as pp

import test_tools

sys.path.append('../../../../')
#sys.path.append('/home/kenfar/Projects/datagristle_file_doer/lib/python2.7/site-packages')
sys.path.append('/home/kenfar/Projects/datagristle_file_doer/lib/python2.7/site-packages')
mod = test_tools.load_script('gristle_processor')


# shut off the printing of warnings & info statements from module
#old_stdout = sys.stdout
#old_stderr = sys.stderr
#null       = open(os.devnull, 'wb')
#sys.stdout = sys.stderr = null





class Test_ProcessDir(object):

    def setup_method(self, method):
"""

import sys
import os
import time
import tempfile
import random
import csv
import pytest
import shutil
import envoy
from pprint import pprint as pp

import test_tools

mod = test_tools.load_script('gristle_dir_merger')


class TestCreateUniqueFileName(object):
    def setup_method(self, method):
        self.dir_name = tempfile.mkdtemp(prefix='test_gristle_dir_merger_')

    def teardown_method(self, method):
        shutil.rmtree(self.dir_name)

    def test_simple_file_name_with_extension(self):
        touch(os.path.join(self.dir_name, 'test.txt'))
        assert 'test.1.txt' == mod.create_unique_file_name(
            self.dir_name, 'test.txt')

    def test_simple_file_name_without_extension(self):
Beispiel #9
0
"""

import sys
import os
import time
import tempfile
import random
import csv
import pytest
import shutil
import envoy
from pprint import pprint as pp

import test_tools

mod = test_tools.load_script('gristle_dir_merger')


class TestCreateUniqueFileName(object):

    def setup_method(self, method):
        self.dir_name = tempfile.mkdtemp(prefix='test_gristle_dir_merger_')
    def teardown_method(self, method):
        shutil.rmtree(self.dir_name)

    def test_simple_file_name_with_extension(self):
        touch(os.path.join(self.dir_name, 'test.txt'))
        assert 'test.1.txt' == mod.create_unique_file_name(self.dir_name, 'test.txt') 

    def test_simple_file_name_without_extension(self):
        touch(os.path.join(self.dir_name, 'test'))