<commit_before># -*- coding: utf-8 -*-

import os
import subprocess


class ProtractorTestCaseMixin(object):
    protractor_conf = 'protractor.conf.js'
    suite = None
    specs = None

    @classmethod
    def setUpClass(cls):
        super(ProtractorTestCaseMixin, cls).setUpClass()
        with open(os.devnull, 'wb') as f:
            subprocess.call(['webdriver-manager', 'update'], stdout=f, stderr=f)
            cls.webdriver = subprocess.Popen(
                ['webdriver-manager', 'start'], stdout=f, stderr=f)

    @classmethod
    def tearDownClass(cls):
        cls.webdriver.kill()
        super(ProtractorTestCaseMixin, cls).tearDownClass()

    def test_run(self):
        protractor_command = 'protractor {}'.format(self.protractor_conf)
        if self.specs:
            protractor_command += ' --specs {}'.format(','.join(self.specs))
        if self.suite:
            protractor_command += ' --suite {}'.format(self.suite)
        return_code = subprocess.call(protractor_command.split())
        self.assertEqual(return_code, 0)<commit_msg>Update to pass live server url as param to protractor<commit_after># -*- coding: utf-8 -*-

import os
import subprocess


class ProtractorTestCaseMixin(object):
    protractor_conf = 'protractor.conf.js'
    suite = None
    specs = None

    @classmethod
    def setUpClass(cls):
        super(ProtractorTestCaseMixin, cls).setUpClass()
        with open(os.devnull, 'wb') as f:
            subprocess.call(['webdriver-manager', 'update'], stdout=f, stderr=f)
            cls.webdriver = subprocess.Popen(
                ['webdriver-manager', 'start'], stdout=f, stderr=f)

    @classmethod
    def tearDownClass(cls):
        cls.webdriver.kill()
        super(ProtractorTestCaseMixin, cls).tearDownClass()

    def test_run(self):
        protractor_command = 'protractor {}'.format(self.protractor_conf)
        if self.specs:
            protractor_command += ' --specs {}'.format(','.join(self.specs))
        if self.suite:
            protractor_command += ' --suite {}'.format(self.suite)
        protractor_command += ' --params.live_server_url={}'.format(self.live_server_url)
        return_code = subprocess.call(protractor_command.split())
        self.assertEqual(return_code, 0)
{'fraction_non_alphanumeric': 0.13185840707964602, 'fraction_numerical': 0.0017699115044247787, 'mean_word_length': 2.8782161234991426, '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': '873143', 'n_tokens_mistral': 722, 'n_tokens_neox': 688, 'n_words': 130}