<commit_before>import unittest
import re, os, shutil, sys
sys.path.extend(['.','..','py'])

import h2o, h2o_cmd, h2o_hosts

# test some random csv data, and some lineend combinations
class Basic(unittest.TestCase):
    def tearDown(self):
        h2o.check_sandbox_for_errors()

    @classmethod
    def setUpClass(cls):
        global localhost
        localhost = h2o.decide_if_localhost()
        if (localhost):
            h2o.build_cloud(node_count=1)
        else:
            h2o_hosts.build_cloud_with_hosts(node_count=1)
        global SYNDATASETS_DIR
        SYNDATASETS_DIR = h2o.make_syn_dir()

    @classmethod
    def tearDownClass(cls):
        h2o.tear_down_cloud()

    def test_A_randomdata2(self):
        print "Using smalldata/datagen1.csv as is"
        csvPathname = h2o.find_file('smalldata/datagen1.csv')
        # have to give the separator == comma...otherwise H2O can't deduce it on this dataset
        parseKey = h2o_cmd.parseFile(csvPathname=csvPathname, timeoutSecs=10, header=1, separator=44)
        h2o_cmd.runRFOnly(parseKey=parseKey, trees=1, response_variable=2, timeoutSecs=10, csvPathname=csvPathname)

    def test_B_randomdata2_1_lineend(self):
        print "Using smalldata/datagen1.csv to create", SYNDATASETS_DIR, "/datagen1.csv with different line ending" 
        # change lineend, case 1
        csvPathname1 = h2o.find_file('smalldata/datagen1.csv')
        csvPathname2 = SYNDATASETS_DIR + '/datagen1_crlf.csv'
        infile = open(csvPathname1, 'r') 
        outfile = open(csvPathname2,'w') # existing file gets erased

        # assume all the test files are unix lineend. 
        # I guess there shouldn't be any "in-between" ones
        # okay if they change I guess.
        for line in infile.readlines():
            outfile.write(line.strip("\n") + "\r")
        infile.close()
        outfile.close()

        parseKey = h2o_cmd.parseFile(csvPathname=csvPathname2, timeoutSecs=10, header=1, separator=44)
        h2o_cmd.runRFOnly(parseKey=parseKey, trees=1, response_variable=2, timeoutSecs=10, csvPathname=csvPathname2)


if __name__ == '__main__':
    h2o.unit_main()<commit_msg>increase timeout<commit_after>import unittest
import re, os, shutil, sys
sys.path.extend(['.','..','py'])

import h2o, h2o_cmd, h2o_hosts

# test some random csv data, and some lineend combinations
class Basic(unittest.TestCase):
    def tearDown(self):
        h2o.check_sandbox_for_errors()

    @classmethod
    def setUpClass(cls):
        global localhost
        localhost = h2o.decide_if_localhost()
        if (localhost):
            h2o.build_cloud(node_count=1)
        else:
            h2o_hosts.build_cloud_with_hosts(node_count=1)
        global SYNDATASETS_DIR
        SYNDATASETS_DIR = h2o.make_syn_dir()

    @classmethod
    def tearDownClass(cls):
        h2o.tear_down_cloud()

    def test_A_randomdata2(self):
        print "Using smalldata/datagen1.csv as is"
        csvPathname = h2o.find_file('smalldata/datagen1.csv')
        # have to give the separator == comma...otherwise H2O can't deduce it on this dataset
        parseKey = h2o_cmd.parseFile(csvPathname=csvPathname, timeoutSecs=10, header=1, separator=44)
        h2o_cmd.runRFOnly(parseKey=parseKey, trees=1, response_variable=2, timeoutSecs=20, csvPathname=csvPathname)

    def test_B_randomdata2_1_lineend(self):
        print "Using smalldata/datagen1.csv to create", SYNDATASETS_DIR, "/datagen1.csv with different line ending" 
        # change lineend, case 1
        csvPathname1 = h2o.find_file('smalldata/datagen1.csv')
        csvPathname2 = SYNDATASETS_DIR + '/datagen1_crlf.csv'
        infile = open(csvPathname1, 'r') 
        outfile = open(csvPathname2,'w') # existing file gets erased

        # assume all the test files are unix lineend. 
        # I guess there shouldn't be any "in-between" ones
        # okay if they change I guess.
        for line in infile.readlines():
            outfile.write(line.strip("\n") + "\r")
        infile.close()
        outfile.close()

        parseKey = h2o_cmd.parseFile(csvPathname=csvPathname2, timeoutSecs=10, header=1, separator=44)
        h2o_cmd.runRFOnly(parseKey=parseKey, trees=1, response_variable=2, timeoutSecs=20, csvPathname=csvPathname2)


if __name__ == '__main__':
    h2o.unit_main()
{'fraction_non_alphanumeric': 0.1014661391668606, 'fraction_numerical': 0.024668373283686294, 'mean_word_length': 3.1809338521400776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7477385', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1452, 'n_words': 306}