<commit_before>import os
import sys
import time
import subprocess
from utils import require_user
from utils import require_8021q
from utils import require_bridge
from utils import require_bond
from nose.plugins.skip import SkipTest
from pyroute2.netlink import NetlinkError

try:
    import importlib
except ImportError:
    importlib = None


class TestExamples(object):

    def setup(self):
        self.pwd = os.getcwd()
        os.chdir('../examples/')
        newdir = os.getcwd()
        if newdir not in sys.path:
            sys.path.append(newdir)

    def teardown(self):
        os.chdir(self.pwd)

    def launcher(self, client, server=None):
        with open(os.devnull, 'w') as fnull:
            if server is not None:
                s = subprocess.Popen([sys.executable, server],
                                     stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
                                     stderr=fnull)
                time.sleep(1)
            if importlib is not None:
                importlib.import_module(client)
            else:
                c = subprocess.Popen([sys.executable, client + '.py'],
                                     stdin=fnull,
                                     stdout=subprocess.PIPE,
                                     stderr=fnull)
                c.communicate()
            if server is not None:
                s.stdin.write(b'\n')
                s.communicate()
                assert s.returncode == 0
            if importlib is None:
                assert c.returncode == 0

    def test_client_server(self):<commit_msg>tests: increase pause between server and client starts<commit_after>import os
import sys
import time
import subprocess
from utils import require_user
from utils import require_8021q
from utils import require_bridge
from utils import require_bond
from nose.plugins.skip import SkipTest
from pyroute2.netlink import NetlinkError

try:
    import importlib
except ImportError:
    importlib = None


class TestExamples(object):

    def setup(self):
        self.pwd = os.getcwd()
        os.chdir('../examples/')
        newdir = os.getcwd()
        if newdir not in sys.path:
            sys.path.append(newdir)

    def teardown(self):
        os.chdir(self.pwd)

    def launcher(self, client, server=None):
        with open(os.devnull, 'w') as fnull:
            if server is not None:
                s = subprocess.Popen([sys.executable, server],
                                     stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
                                     stderr=fnull)
                time.sleep(3)
            if importlib is not None:
                importlib.import_module(client)
            else:
                c = subprocess.Popen([sys.executable, client + '.py'],
                                     stdin=fnull,
                                     stdout=subprocess.PIPE,
                                     stderr=fnull)
                c.communicate()
            if server is not None:
                s.stdin.write(b'\n')
                s.communicate()
                assert s.returncode == 0
            if importlib is None:
                assert c.returncode == 0

    def test_client_server(self):
{'fraction_non_alphanumeric': 0.07696951403561726, 'fraction_numerical': 0.004829459704195593, 'mean_word_length': 1.4584569732937684, '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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4296475', 'n_tokens_mistral': 921, 'n_tokens_neox': 864, 'n_words': 230}