'webkitcorepy')) and webkitcorepy_path not in sys.path: sys.path.insert(0, webkitcorepy_path) _maybe_add_webkitcorepy_path() try: from webkitcorepy import AutoInstall, Package, Version except ImportError: raise ImportError( "'webkitcorepy' could not be found on your Python path.\n" + "You are not running from a WebKit checkout.\n" + "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`" ) version = Version(0, 14, 6) AutoInstall.register(Package('fasteners', Version(0, 15, 0))) AutoInstall.register(Package('monotonic', Version(1, 5))) AutoInstall.register(Package('whichcraft', Version(0, 6, 1))) AutoInstall.register(Package('xmltodict', Version(0, 11, 0))) from webkitscmpy.contributor import Contributor from webkitscmpy.commit import Commit from webkitscmpy.scm_base import ScmBase from webkitscmpy import local from webkitscmpy import mocks name = 'webkitscmpy'
import sys # We always want the real system version os.environ['SYSTEM_VERSION_COMPAT'] = '0' libraries = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'libraries') sys.path.insert(0, os.path.join(libraries, 'webkitcorepy')) if sys.platform == 'darwin': is_root = not os.getuid() does_own_libraries = os.stat(libraries).st_uid == os.getuid() if (is_root or not does_own_libraries): libraries = os.path.expanduser('~/Library/webkitpy') from webkitcorepy import AutoInstall, Package, Version AutoInstall.set_directory(os.path.join(libraries, 'autoinstalled', 'python-{}'.format(sys.version_info[0]))) if sys.version_info > (3, 4): # Python >=3.5.* AutoInstall.register(Package('pylint', Version(2, 6, 0))) else: AutoInstall.register(Package('pylint', Version(0, 28, 0))) AutoInstall.register(Package('logilab.common', Version(0, 58, 1), pypi_name='logilab-common', aliases=['logilab'])) AutoInstall.register(Package('logilab.astng', Version(0, 24, 1), pypi_name='logilab-astng', aliases=['logilab'])) AutoInstall.register(Package('pathlib', Version(2, 3, 5), pypi_name='pathlib2')) AutoInstall.register(Package('atomicwrites', Version(1, 1, 5))) AutoInstall.register(Package('attr', Version(18, 1, 0), pypi_name='attrs')) AutoInstall.register(Package('bs4', Version(4, 9, 3), pypi_name='beautifulsoup4')) AutoInstall.register(Package('configparser', Version(4, 0, 2)))
def _run_tests(self, names): # Make sure PYTHONPATH is set up properly. sys.path = self.finder.additional_paths(sys.path) + sys.path # We autoinstall everything up so that we can run tests concurrently # and not have to worry about autoinstalling packages concurrently. self.printer.write_update("Checking autoinstalled packages ...") from webkitpy.thirdparty import autoinstall_everything autoinstall_everything() from webkitcorepy import AutoInstall AutoInstall.install_everything() start_time = time.time() if getattr(self._options, 'coverage', False): _log.warning("Checking code coverage, so running things serially") self._options.child_processes = 1 import coverage cov = coverage.coverage(omit=[ "/usr/*", "*/webkitpy/thirdparty/autoinstalled/*", "*/webkitpy/thirdparty/BeautifulSoup.py", "*/webkitpy/thirdparty/BeautifulSoup_legacy.py", ]) cov.start() self.printer.write_update("Checking imports ...") if not self._check_imports(names): return False self.printer.write_update("Finding the individual test methods ...") loader = _Loader() parallel_tests, serial_tests = self._test_names(loader, names) self.printer.write_update("Running the tests ...") self.printer.num_tests = len(parallel_tests) + len(serial_tests) start = time.time() test_runner = Runner(self.printer, loader) test_runner.run(parallel_tests, getattr(self._options, 'child_processes', 1)) test_runner.run(serial_tests, 1) end_time = time.time() self.printer.print_result(time.time() - start) if getattr(self._options, 'json', False): _print_results_as_json( sys.stdout, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors) if getattr(self._options, 'json_file_name', None): self._options.json_file_name = os.path.abspath( self._options.json_file_name) with open(self._options.json_file_name, 'w') as json_file: _print_results_as_json( json_file, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors) if getattr(self._options, 'coverage', False): cov.stop() cov.save() failed_uploads = 0 if getattr(self._options, 'report_urls', None): self.printer.meter.writeln('\n') self.printer.write_update('Preparing upload data ...') # Empty test results indicate a PASS. results = {test: {} for test in test_runner.tests_run} for test, errors in test_runner.errors: results[test] = Upload.create_test_result( actual=Upload.Expectations.ERROR, log='/n'.join(errors)) for test, failures in test_runner.failures: results[test] = Upload.create_test_result( actual=Upload.Expectations.FAIL, log='/n'.join(failures)) _host.initialize_scm() upload = Upload( suite=self._options.suite or 'webkitpy-tests', configuration=Upload.create_configuration( platform=_host.platform.os_name, version=str(_host.platform.os_version), version_name=_host.platform.os_version_name(), style=self.upload_style, sdk=_host.platform.build_version(), flavor=self._options.result_report_flavor, architecture=_host.platform.architecture(), ), details=Upload.create_details(options=self._options), commits=[ Upload.create_commit( repository_id='webkit', id=_host.scm().native_revision(_webkit_root), branch=_host.scm().native_branch(_webkit_root), ) ], run_stats=Upload.create_run_stats( start_time=start_time, end_time=end_time, tests_skipped=len(test_runner.tests_run) - len(parallel_tests) - len(serial_tests), ), results=results, ) for url in self._options.report_urls: self.printer.write_update('Uploading to {} ...'.format(url)) failed_uploads = failed_uploads if upload.upload( url, log_line_func=self.printer.meter.writeln) else ( failed_uploads + 1) self.printer.meter.writeln('Uploads completed!') if getattr(self._options, 'coverage', False): cov.report(show_missing=False) return not self.printer.num_errors and not self.printer.num_failures and not failed_uploads
# Keep this file free of any code or import statements that could # cause either an error to occur or a log message to be logged. # This ensures that calling code can import initialization code from # webkitpy before any errors or log messages due to code in this file. # Initialization code can include things like version-checking code and # logging configuration code. # # We do not execute any version-checking code or logging configuration # code in this file so that callers can opt-in as they want. This also # allows different callers to choose different initialization code, # as necessary. import os import sys libraries = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'libraries') sys.path.insert(0, os.path.join(libraries, 'webkitcorepy')) if sys.platform == 'darwin': is_root = not os.getuid() does_own_libraries = os.stat(libraries).st_uid == os.getuid() if (is_root or not does_own_libraries): libraries = os.path.expanduser('~/Library/webkitpy') from webkitcorepy import AutoInstall, Package, Version AutoInstall.set_directory(os.path.join(libraries, 'autoinstalled', 'python-{}'.format(sys.version_info[0]))) AutoInstall.register(Package('coverage', Version(5, 2, 1))) AutoInstall.register(Package('toml', Version(0, 10, 1)))
sys.path.insert(0, webkitcorepy_path) _maybe_add_webkitcorepy_path() try: from webkitcorepy import AutoInstall, Package, Version except ImportError: raise ImportError( "'webkitcorepy' could not be found on your Python path.\n" + "You are not running from a WebKit checkout.\n" + "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`" ) version = Version(0, 9, 2) AutoInstall.register(Package('entrypoints', Version(0, 3, 0))) AutoInstall.register(Package('fasteners', Version(0, 15, 0))) AutoInstall.register(Package('keyring', Version(11, 1, 0))) AutoInstall.register(Package('monotonic', Version(1, 5))) AutoInstall.register(Package('xmltodict', Version(0, 12, 0))) from webkitscmpy.contributor import Contributor from webkitscmpy.commit import Commit from webkitscmpy.scm_base import ScmBase from webkitscmpy import local from webkitscmpy import mocks name = 'webkitscmpy'
def _maybe_add_webkitcorepy_path(): # Hopefully we're beside webkitcorepy, otherwise webkitcorepy will need to be installed. libraries_path = os.path.dirname(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) webkitcorepy_path = os.path.join(libraries_path, 'webkitcorepy') if os.path.isdir(webkitcorepy_path) and os.path.isdir(os.path.join(webkitcorepy_path, 'webkitcorepy')) and webkitcorepy_path not in sys.path: sys.path.insert(0, webkitcorepy_path) _maybe_add_webkitcorepy_path() try: from webkitcorepy import AutoInstall, Package, Version except ImportError: raise ImportError( "'webkitcorepy' could not be found on your Python path.\n" + "You are not running from a WebKit checkout.\n" + "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`" ) version = Version(0, 1, 1) AutoInstall.register(Package('click'), Version(7, 1, 2)) AutoInstall.register(Package('flask'), Version(1, 1, 2)) AutoInstall.register(Package('itsdangerous'), Version(2, 0, 0)) AutoInstall.register(Package('jinja2'), Version(3, 0, 0)) AutoInstall.register(Package('markupsafe'), Version(2, 0, 0)) AutoInstall.register(Package('werkzeug'), Version(1, 0, 1)) name = 'webkitflaskpy'
# logging configuration code. # # We do not execute any version-checking code or logging configuration # code in this file so that callers can opt-in as they want. This also # allows different callers to choose different initialization code, # as necessary. import os import sys libraries = os.path.join( os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'libraries') sys.path.insert(0, os.path.join(libraries, 'webkitcorepy')) if sys.platform == 'darwin': is_root = not os.getuid() does_own_libraries = os.stat(libraries).st_uid == os.getuid() if (is_root or not does_own_libraries): libraries = os.path.expanduser('~/Library/webkitpy') from webkitcorepy import AutoInstall, Package, Version AutoInstall.set_directory( os.path.join(libraries, 'autoinstalled', 'python-{}'.format(sys.version_info[0]))) AutoInstall.register(Package('coverage', Version(5, 2, 1))) AutoInstall.register(Package('selenium', Version(3, 141, 0))) AutoInstall.register(Package('toml', Version(0, 10, 1))) AutoInstall.register(Package('webkitscmpy', Version(0, 0, 1)), local=True)
webkitcorepy_path, 'webkitcorepy')) and webkitcorepy_path not in sys.path: sys.path.insert(0, webkitcorepy_path) _maybe_add_webkitcorepy_path() try: from webkitcorepy import AutoInstall, Package, Version except ImportError: raise ImportError( "'webkitcorepy' could not be found on your Python path.\n" + "You are not running from a WebKit checkout.\n" + "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`" ) version = Version(0, 5, 3) AutoInstall.register(Package('fasteners', Version(0, 15, 0))) AutoInstall.register(Package('monotonic', Version(1, 5))) AutoInstall.register(Package('xmltodict', Version(0, 12, 0))) from webkitscmpy.contributor import Contributor from webkitscmpy.commit import Commit from webkitscmpy.scm_base import ScmBase from webkitscmpy import local from webkitscmpy import mocks name = 'webkitscmpy'
_maybe_add_webkit_python_library_paths() try: from webkitcorepy import AutoInstall, Package, Version except ImportError: raise ImportError( "'webkitcorepy' could not be found on your Python path.\n" + "You are not running from a WebKit checkout.\n" + "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`" ) version = Version(3, 0, 2) import webkitflaskpy AutoInstall.register(Package('aenum', Version(2, 2, 6))) AutoInstall.register(Package('attrs', Version(21, 2, 0))) AutoInstall.register(Package('aioredis', Version(1, 3, 1))) AutoInstall.register(Package('async-timeout', Version(3, 0, 1))) AutoInstall.register(Package('boto3', Version(1, 16, 63), wheel=True)) AutoInstall.register(Package('botocore', Version(1, 19, 63), wheel=True)) AutoInstall.register(Package('cassandra', Version(3, 25, 0), pypi_name='cassandra-driver', slow_install=True)) AutoInstall.register(Package('click', Version(7, 1, 2))) AutoInstall.register(Package('Crypto', Version(3, 10, 1), pypi_name='pycryptodome')) AutoInstall.register(Package('fakeredis', Version(1, 5, 2))) AutoInstall.register(Package('geomet', Version(0, 2, 1))) AutoInstall.register(Package('gremlinpython', Version(3, 4, 6))) AutoInstall.register(Package('hiredis', Version(1, 1, 0))) AutoInstall.register(Package('isodate', Version(0, 6, 0))) AutoInstall.register(Package('jmespath', Version(0, 10, 0), wheel=True)) AutoInstall.register(Package('lupa', Version(1, 9)))
# Required for Python to search this directory for module files # Keep this file free of any code or import statements that could # cause either an error to occur or a log message to be logged. # This ensures that calling code can import initialization code from # webkitpy before any errors or log messages due to code in this file. # Initialization code can include things like version-checking code and # logging configuration code. # # We do not execute any version-checking code or logging configuration # code in this file so that callers can opt-in as they want. This also # allows different callers to choose different initialization code, # as necessary. import os import sys libraries = os.path.join( os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'libraries') sys.path.insert(0, os.path.join(libraries, 'webkitcorepy')) from webkitcorepy import AutoInstall AutoInstall.set_directory( os.path.join(libraries, 'autoinstalled', 'python-{}'.format(sys.version_info[0])))