<commit_before>import rexviewer as r
import circuits

import time

user, pwd, server = "Test User", "test", "localhost:9000"
#user, pwd, server = "d d", "d", "world.evocativi.com:8002"

class TestRunner(circuits.Component):
    def __init__(self):
        circuits.Component.__init__(self)
        self.testgen = self.run()

    def update(self, deltatime):
        prev = None
        try:
            status = self.testgen.next()
            if status:
                print "Test state", status
                prev = status
            else:
                print "Test state", prev, "still running"
        except StopIteration:
            print "Test finished"

    def run(self):
        raise NotImplementedError

    def timer_start(self):
        self.timer_started = time.time()

    def elapsed(self, n):
        return (time.time() - self.timer_started) > n
            

class TestLoginLogoutExit(TestRunner):
    wait_time = 30

    def run(self):
        yield "login"
        self.timer_start()
        r.startLoginOpensim(user, pwd, server)
        print "ELAPSED:", self.elapsed(self.wait_time)
        while not self.elapsed(self.wait_time):
            print "X",
            yield None

        yield "logging out"
        self.timer_start()
        r.logout()
        while not self.elapsed(self.wait_time):
            yield None

        yield "exiting"
        r.exit()
<commit_msg>automated test runner: change default login creds to our public demo server so this should always work, and fishworld is good for testing. remove some debug spam.<commit_after>import rexviewer as r
import circuits

import time

user, pwd, server = "Test Bot", "test", "world.realxtend.org:9000"
#user, pwd, server = "d d", "d", "world.evocativi.com:8002"

class TestRunner(circuits.Component):
    def __init__(self):
        circuits.Component.__init__(self)
        self.testgen = self.run()

    def update(self, deltatime):
        prev = None
        try:
            status = self.testgen.next()
            if status:
                print "Test state", status
                prev = status
            #else:
                #print "Test state", prev, "still running"
        except StopIteration:
            print "Test finished"

    def run(self):
        raise NotImplementedError

    def timer_start(self):
        self.timer_started = time.time()

    def elapsed(self, n):
        return (time.time() - self.timer_started) > n
            

class TestLoginLogoutExit(TestRunner):
    wait_time = 30

    def run(self):
        yield "login"
        self.timer_start()
        r.startLoginOpensim(user, pwd, server)
        print "ELAPSED:", self.elapsed(self.wait_time)
        while not self.elapsed(self.wait_time):
            #print "X",
            yield None

        yield "logging out"
        self.timer_start()
        r.logout()
        while not self.elapsed(self.wait_time):
            yield None

        yield "exiting"
        r.exit()

{'fraction_non_alphanumeric': 0.10104061765693186, 'fraction_numerical': 0.00671366230278617, 'mean_word_length': 2.0192502532928063, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4720722', 'n_tokens_mistral': 913, 'n_tokens_neox': 867, 'n_words': 240}