Esempio n. 1
0
 def setUp(self):
     self.cli = CLIParser()
Esempio n. 2
0
class TestCommandLineParameters(unittest.TestCase):
    def setUp(self):
        self.cli = CLIParser()

    def test_default_settings(self):
        self.cli.parseForSedater(['foo'])
        self.assertFalse(self.cli.args.csv_headers)
        self.assertFalse(self.cli.args.left_calibration)
        self.assertFalse(self.cli.args.right_calibration)
        self.assertFalse(self.cli.args.output_dir)
    def test_toggle_csv_header(self):
        self.cli.parseForSedater(['foo'])
        self.assertFalse(self.cli.args.csv_headers)
        self.cli.parseForSedater(['-c', 'foo'])
        self.assertTrue(self.cli.args.csv_headers)
        self.cli.parseForSedater(['--csv-headers', 'foo'])
        self.assertTrue(self.cli.args.csv_headers)
    def test_left_calibration_file(self):
        ref = res = 'foobar'
        self.cli.parseForSedater(['-l', ref, 'barfoo'])
        self.assertEquals(self.cli.args.left_calibration, res)
        self.cli.parseForSedater(['--left-calibration', ref, 'barfoo'])
        self.assertEquals(self.cli.args.left_calibration, res)
    def test_right_calibration_file(self):
        ref = res = 'foobar'
        self.cli.parseForSedater(['-r', ref, 'barfoo'])
        self.assertEquals(self.cli.args.right_calibration, res)
        self.cli.parseForSedater(['--right-calibration', ref, 'barfoo'])
        self.assertEquals(self.cli.args.right_calibration, res)
    def test_output_dir(self):
        ref = res = 'foobar'
        self.cli.parseForSedater(['-o', ref, 'barfoo'])
        self.assertEquals(self.cli.args.output_dir, res)
        self.cli.parseForSedater(['--output-dir', ref, 'barfoo'])
        self.assertEquals(self.cli.args.output_dir, res)
    def test_input_source_arguments(self):
        ref = res = ['foo', 'bar', 'foobar', 'barfoo']
        self.cli.parseForSedater(ref)
        self.assertEquals(self.cli.args.inputSource, ref)
Esempio n. 3
0
File: main.py Progetto: nce/sedater
import sys, os
sys.path.insert(0, os.getcwd())

from sedater.options import CLIParser

from sedater.filesystem import Crawler
from sedater.rawvalidation import RawConverter
from sedater.txtvalidation import TxtConverter
from sedater.export import CSVExporter
from sedater.export import XMLExporter

from sedater.lib.shared import UninitializedSensor
from sedater.lib.shared import Orientation

if __name__ == "__main__":
    cli = CLIParser()
    if not cli.parseForSedater(sys.argv[1:]):
        sys.exit(2)

    importer = Crawler()
    for source in cli.args.inputSource:
        # Data Export preparations
        if cli.args.output_dir:
            outputDir = cli.args.output_dir + '/'
        else:
            outputDir = os.path.dirname(source) + '/'

        # Data Import
        importer.crawl(source)

        # All input sources are crawled