Hello community, here is the log from the commit of package python-webruntime for openSUSE:Factory checked in at 2019-03-26 22:31:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-webruntime (Old) and /work/SRC/openSUSE:Factory/.python-webruntime.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-webruntime" Tue Mar 26 22:31:36 2019 rev:2 rq:686464 version:0.5.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-webruntime/python-webruntime.changes 2018-11-10 16:58:01.359853008 +0100 +++ /work/SRC/openSUSE:Factory/.python-webruntime.new.25356/python-webruntime.changes 2019-03-26 22:31:46.837715077 +0100 @@ -1,0 +2,7 @@ +Tue Mar 19 15:36:31 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 0.5.6: + * no upstream changelog +- Run tests + +------------------------------------------------------------------- Old: ---- webruntime-0.5.4.tar.gz New: ---- webruntime-0.5.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-webruntime.spec ++++++ --- /var/tmp/diff_new_pack.1dJjQ3/_old 2019-03-26 22:31:47.697714870 +0100 +++ /var/tmp/diff_new_pack.1dJjQ3/_new 2019-03-26 22:31:47.701714869 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-webruntime # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,24 +19,23 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-webruntime -Version: 0.5.4 +Version: 0.5.6 Release: 0 Summary: A python package to launch HTML5 apps in the browser or a desktop-like runtime License: BSD-2-Clause Group: Development/Languages/Python -Url: http://webruntime.readthedocs.io +URL: https://github.com/flexxui/webruntime Source: https://files.pythonhosted.org/packages/source/w/webruntime/webruntime-%{version}.tar.gz -BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} -# SECTION test requirements -BuildRequires: %{python_module dialite} -BuildRequires: %{python_module pytest} -# /SECTION BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-dialite BuildArch: noarch - +# SECTION test requirements +BuildRequires: %{python_module dialite} +BuildRequires: %{python_module pytest} +BuildRequires: MozillaFirefox +# /SECTION %python_subpackages %description @@ -54,10 +53,8 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} -# Test files missing -# See https://github.com/flexxui/webruntime/pull/8 -# %%check -# %%python_exec setup.py test +%check +%pytest %files %{python_files} %doc README.md ++++++ webruntime-0.5.4.tar.gz -> webruntime-0.5.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/MANIFEST.in new/webruntime-0.5.6/MANIFEST.in --- old/webruntime-0.5.4/MANIFEST.in 2018-04-11 23:18:13.000000000 +0200 +++ new/webruntime-0.5.6/MANIFEST.in 2018-11-02 13:11:07.000000000 +0100 @@ -1,5 +1,8 @@ include LICENSE README.md +recursive-include tasks * +recursive-include webruntime/tests * + global-exclude .git* global-exclude *.pyo global-exclude *.pyc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/PKG-INFO new/webruntime-0.5.6/PKG-INFO --- old/webruntime-0.5.4/PKG-INFO 2018-09-11 14:38:33.000000000 +0200 +++ new/webruntime-0.5.6/PKG-INFO 2018-12-03 16:33:43.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: webruntime -Version: 0.5.4 +Version: 0.5.6 Summary: Launch HTML5 apps in the browser or a desktop-like runtime. Home-page: http://webruntime.readthedocs.io Author: Almar Klein and contributors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/setup.cfg new/webruntime-0.5.6/setup.cfg --- old/webruntime-0.5.4/setup.cfg 2018-09-11 14:38:33.000000000 +0200 +++ new/webruntime-0.5.6/setup.cfg 2018-12-03 16:33:43.000000000 +0100 @@ -1,7 +1,7 @@ [flake8] exclude = test_*.py,exp/*,docs/*,build/*,dist/* -ignore = W291,W293,E123,E124,E126,E127,E203,E225,E226,E265,E301,E302,E303,E402, - E266,E731,E128,E306,E305,I,D,T,CG,N8 +ignore = W291,W293,E123,W504,E124,E126,E127,E203,E225,E226,E265,E301,E302,E303,E402, + E266,E731,E128,E306,E305,I,D,T,CG,N8,S1 max-line-length = 88 [coverage:report] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/README.md new/webruntime-0.5.6/tasks/README.md --- old/webruntime-0.5.4/tasks/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/README.md 2018-02-26 17:19:39.000000000 +0100 @@ -0,0 +1,33 @@ +----- +tasks +----- + +Tools for developers, such as testing, building docs/website, etc. + +Usage:: + + invoke task ... + invoke --help task + +This makes use of the invoke package to translate CLI commands to function +calls. This package is set up so that new tasks can be added simply by adding +a module that defines one or more tasks, this makes it easy to share tasks +between projects. + +Each project must implement its own _config.py, so that the tasks themselves +can be project-agnostic. + +Names that you can `from ._config import ...`: + +* NAME - the name of the project +* THIS_DIR - the path of the tasks directory +* ROOT_DIR - the root path of the repository +* DOC_DIR - the path to the docs +* DOC_BUILD_DIR - the path to where the docs are build +* ... - more may be added, depending on what tasks are present + + +License +------- + +Consider this code public domain unless stated otherwise. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/__init__.py new/webruntime-0.5.6/tasks/__init__.py --- old/webruntime-0.5.4/tasks/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/__init__.py 2018-02-26 17:19:39.000000000 +0100 @@ -0,0 +1,43 @@ +""" +Main file for invoke tasks. We auto-import all modules here, so that +one can simply add tasks by adding files. +""" + +import os + +from invoke import Collection, Task + +# Get root directory of the package +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) +ROOT_DIR = os.path.dirname(THIS_DIR) + +# Init collection; invoke picks this up as the main "list of tasks" +ns = Collection() + +# Automatically collect tasks from submodules +for fname in os.listdir(THIS_DIR): + # Does this look like a module that we want? + if fname.startswith('_') or not fname.endswith('.py'): + continue + modname = fname[:-3] + # Import it + m = __import__(modname, level=1, fromlist=[], globals=globals()) + # Collect all tasks and collections + collections, tasks = {}, {} + for name in dir(m): + ob = getattr(m, name) + if isinstance(ob, Task): + tasks[name] = ob + elif isinstance(ob, Collection): + collections[name] = ob + # Add collections + for name, ob in collections.items(): + ns.add_collection(ob, name) + # Add tasks that are not already in a collection + for name, ob in tasks.items(): + add_task = True + for c in collections.values(): + if ob in c.tasks.values(): + add_task = False + if add_task: + ns.add_task(ob, name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/__main__.py new/webruntime-0.5.6/tasks/__main__.py --- old/webruntime-0.5.4/tasks/__main__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/__main__.py 2018-02-26 17:19:39.000000000 +0100 @@ -0,0 +1,14 @@ +""" +Make this module itself executable as an alias for invoke. +""" + +import sys +import subprocess + +cmd = ['invoke'] +if len(sys.argv) == 1: + cmd.append('help') +else: + cmd.extend(sys.argv[1:]) + +subprocess.check_call(cmd) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/_config.py new/webruntime-0.5.6/tasks/_config.py --- old/webruntime-0.5.4/tasks/_config.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/_config.py 2018-02-26 23:03:24.000000000 +0100 @@ -0,0 +1,11 @@ +""" +Config and definitions specific to Webruntime. +""" + +import os.path as op + +from . import ROOT_DIR, THIS_DIR # noqa + +NAME = 'webruntime' +DOC_DIR = op.join(ROOT_DIR, 'docs') +DOC_BUILD_DIR = op.join(DOC_DIR, '_build') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/clean.py new/webruntime-0.5.6/tasks/clean.py --- old/webruntime-0.5.4/tasks/clean.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/clean.py 2018-02-26 17:19:39.000000000 +0100 @@ -0,0 +1,33 @@ +import os +import shutil +import fnmatch + +from invoke import task + +from ._config import ROOT_DIR, NAME + + +@task +def clean(ctx): + """ clear all .pyc modules and __pycache__ dirs + """ + count1, count2 = 0, 0 + + for root, dirnames, filenames in os.walk(ROOT_DIR): + for dirname in dirnames: + if dirname == '__pycache__': + shutil.rmtree(os.path.join(root, dirname)) + count1 += 1 + print('removed %i __pycache__ dirs' % count1) + + for root, dirnames, filenames in os.walk(ROOT_DIR): + for filename in fnmatch.filter(filenames, '*.pyc'): + os.remove(os.path.join(root, filename)) + count2 += 1 + print('removed %i .pyc files' % count2) + + for dir in ['dist', 'build', NAME+'.egg-info', 'htmlcov']: + dirname = os.path.join(ROOT_DIR, dir) + if os.path.isdir(dirname): + shutil.rmtree(dirname) + print('Removed directory %r' % dir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/copyright.py new/webruntime-0.5.6/tasks/copyright.py --- old/webruntime-0.5.4/tasks/copyright.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/copyright.py 2018-02-26 17:19:39.000000000 +0100 @@ -0,0 +1,38 @@ +import os + +from ._config import ROOT_DIR + +from invoke import task + + +@task +def copyright(ctx): + """ list usage of copyright notices + + The use of copyright notices should be limited to files that are likely + to be used in other projects, or to make appropriate attributions for code + taken from other projects. Other than that, git geeps track of what person + wrote what. + """ + + # Processing the whole root directory + for dirpath, dirnames, filenames in os.walk(ROOT_DIR): + # Check if we should skip this directory + reldirpath = os.path.relpath(dirpath, ROOT_DIR) + if reldirpath[0] in '._' or reldirpath.endswith('__pycache__'): + continue + if os.path.split(reldirpath)[0] in ('build', 'dist'): + continue + # Process files + for fname in filenames: + if not fname.endswith('.py'): + continue + # Open and check + filename = os.path.join(dirpath, fname) + text = open(filename, 'rt', encoding='utf-8').read() + if 'copyright' in text[:200].lower(): + print( + 'Copyright in %s%s%s' % (reldirpath, os.path.sep, fname)) + for i, line in enumerate(text[:200].splitlines()): + if 'copyright' in line.lower(): + print(' line %i: %s' % (i+1, line)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/docs.py new/webruntime-0.5.6/tasks/docs.py --- old/webruntime-0.5.4/tasks/docs.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/docs.py 2018-02-26 17:19:39.000000000 +0100 @@ -0,0 +1,62 @@ +import os +import sys +import os.path as op +import shutil + +from invoke import task +from ._config import DOC_DIR, DOC_BUILD_DIR + + +@task(help=dict(clean='clear the doc output; start fresh', + build='build html docs', + show='show the docs in the browser.')) +def docs(ctx, clean=False, build=False, show=False, **kwargs): + """ make API documentation + """ + # Prepare + + if not (clean or build or show): + sys.exit('Task "docs" must be called with --clean, --build or --show') + + if clean: + sphinx_clean(DOC_BUILD_DIR) + + if build: + sphinx_build(DOC_DIR, DOC_BUILD_DIR) + + if show: + sphinx_show(os.path.join(DOC_BUILD_DIR, 'html')) + + +def sphinx_clean(build_dir): + if op.isdir(build_dir): + shutil.rmtree(build_dir) + os.mkdir(build_dir) + os.mkdir(os.path.join(build_dir, 'html')) + print('Cleared build directory.') + + +def sphinx_build(src_dir, build_dir): + import sphinx + cmd = [ '-b', 'html', + '-d', op.join(build_dir, 'doctrees'), + src_dir, # Source + op.join(build_dir, 'html'), # Dest + ] + + if sphinx.version_info > (1, 7): + import sphinx.cmd.build + ret = sphinx.cmd.build.build_main(cmd) + else: + ret = sphinx.build_main(['sphinx-build'] + cmd) + if ret != 0: + raise RuntimeError('Sphinx error: %s' % ret) + print("Build finished. The HTML pages are in %s/html." % build_dir) + + +def sphinx_show(html_dir): + index_html = op.join(html_dir, 'index.html') + if not op.isfile(index_html): + sys.exit('Cannot show pages, build the html first.') + import webbrowser + webbrowser.open_new_tab(index_html) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/help.py new/webruntime-0.5.6/tasks/help.py --- old/webruntime-0.5.4/tasks/help.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/help.py 2018-02-26 17:19:39.000000000 +0100 @@ -0,0 +1,17 @@ +import subprocess + +from invoke import task + +from ._config import NAME + + +@task +def help(ctx): + """Get info on usage. + """ + + print('Developer tools for project %s\n' % NAME.capitalize()) + print(' invoke <task> [arg] to run a task') + print(' invoke --help <task> to get info on a task') + print() + subprocess.call('invoke --list') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/tasks/test.py new/webruntime-0.5.6/tasks/test.py --- old/webruntime-0.5.4/tasks/test.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/tasks/test.py 2018-02-26 23:03:14.000000000 +0100 @@ -0,0 +1,124 @@ +import os +import sys + +from invoke import task + +from ._config import ROOT_DIR, NAME + + +@task +def lint(ctx): + """ alias for "invoke test --style" + """ + test_style() + + +@task(optional=['unit', 'style'], + help=dict(unit='run unit tests (pytest) on given subdir (default ".")', + style='run style tests (flake8) on given subdir (default ".")', + cover='show test coverage')) +def test(ctx, unit='', style='', cover=False): + """ run tests (unit, style) + """ + + if not (unit or style or cover): + sys.exit('Test task needs --unit, --style or --cover') + if unit: + test_unit('.' if not isinstance(unit, str) else unit) + if style: + test_style('.' if not isinstance(style, str) else style) + if cover: + show_coverage_html() + + +def test_unit(rel_path='.'): + # Ensure we have pytest + try: + import pytest # noqa + except ImportError: + sys.exit('Cannot do unit tests, pytest not installed') + # Get path to test + py2 = sys.version_info[0] == 2 + rel_path = NAME + '/' + rel_path + test_path = os.path.join(ROOT_DIR, rel_path) + # Import from installed, or from ROOT_DIR + if py2 or os.getenv('TEST_INSTALL', '').lower() in ('1', 'yes', 'true'): + if ROOT_DIR in sys.path: + sys.path.remove(ROOT_DIR) + os.chdir(os.path.expanduser('~')) + m = __import__(NAME) + assert ROOT_DIR not in os.path.abspath(m.__path__[0]) + else: + os.chdir(ROOT_DIR) + m = __import__(NAME) + assert ROOT_DIR in os.path.abspath(m.__path__[0]) + # Start tests + _enable_faulthandler() + try: + res = pytest.main(['--cov', NAME, '--cov-config=.coveragerc', + '--cov-report=term', '--cov-report=html', test_path]) + sys.exit(res) + finally: + m = __import__(NAME) + print('Unit tests were performed on', str(m)) + + +def show_coverage_term(): + from coverage import coverage + cov = coverage(auto_data=False, branch=True, data_suffix=None, + source=[NAME]) # should match testing/_coverage.py + cov.load() + cov.report() + + +def show_coverage_html(): + import webbrowser + from coverage import coverage + + print('Generating HTML...') + os.chdir(ROOT_DIR) + cov = coverage(auto_data=False, branch=True, data_suffix=None, + source=[NAME]) # should match testing/_coverage.py + cov.load() + cov.html_report() + print('Done, launching browser.') + fname = os.path.join(os.getcwd(), 'htmlcov', 'index.html') + if not os.path.isfile(fname): + raise IOError('Generated file not found: %s' % fname) + webbrowser.open_new_tab(fname) + + +def test_style(rel_path='.'): + # Ensure we have flake8 + try: + import flake8 # noqa + from flake8.main.application import Application + except ImportError as err: + sys.exit('Cannot do style test: ' + str(err)) + # Prepare + os.chdir(ROOT_DIR) + sys.argv[1:] = [NAME + '/' + rel_path] + # Do test + print('Running flake8 tests ...') + app = Application() + app.run() + # Report + nerrors = app.result_count + if nerrors: + print('Arg! Found %i style errors.' % nerrors) + else: + print('Hooray, no style errors found!') + # Exit (will exit(1) if errors) + app.exit() + + +def _enable_faulthandler(): + """ Enable faulthandler (if we can), so that we get tracebacks + on segfaults. + """ + try: + import faulthandler + faulthandler.enable() + print('Faulthandler enabled') + except Exception: + print('Could not enable faulthandler') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/webruntime/__init__.py new/webruntime-0.5.6/webruntime/__init__.py --- old/webruntime-0.5.4/webruntime/__init__.py 2018-09-11 14:37:27.000000000 +0200 +++ new/webruntime-0.5.6/webruntime/__init__.py 2018-12-03 16:32:43.000000000 +0100 @@ -24,7 +24,7 @@ """ -__version__ = '0.5.4' +__version__ = '0.5.6' import sys @@ -62,7 +62,7 @@ _aliases = {'app': 'firefox-app or nw-app', - 'browser': ('chrome-browser or firefox-browser or edge-browser ' + 'browser': ('firefox-browser or chrome-browser or edge-browser ' 'or default-browser'), 'chrome-browser': 'googlechrome-browser or chromium-browser', 'chrome-app': 'googlechrome-app or chromium-app', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/webruntime/tests/test_dont_leave_trails.py new/webruntime-0.5.6/webruntime/tests/test_dont_leave_trails.py --- old/webruntime-0.5.4/webruntime/tests/test_dont_leave_trails.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/webruntime/tests/test_dont_leave_trails.py 2018-09-11 14:28:48.000000000 +0200 @@ -0,0 +1,99 @@ +""" +Verify that the app runtimes do not leave profile directories around. We've +had firefox-app spam the user directory before, and we want to make sure that does not +happen again. +""" + +import os +import time +import tempfile + +import webruntime +from webruntime.util.testing import run_tests_if_main, skip + +userdir = os.path.expanduser('~') + + +def index(): + """ Get a set of filenames for the current user directory. + """ + filenames = set() + for root, dirs, files in os.walk(userdir): + for fname in dirs: + # if 'temp' in fname.lower(): + # continue # exception for FF, which seems to clean up itself + filenames.add(os.path.join(root, fname)) + for fname in files: + if len(fname) < 15: # only simple names, not uids + if 'fontconfig' in root: + continue # CI + filenames.add(os.path.join(root, fname)) + return filenames + + +def run_once(html_filename, runtime): + x = webruntime.launch(html_filename, runtime) + time.sleep(1.5) + x.close() + time.sleep(0.5) + + +def notrailtester(runtime, n=4): + + html_filename = os.path.join(tempfile.gettempdir(), 'webruntime_empty_page.html') + with open(html_filename, 'wb') as f: + f.write('<html><body>test page</body></html>'.encode()) + + # Apparently, CI needs some more time for FF init its file system + # It seems that even ~/Desktop is not there initially, which we use to + # detect when we're good to go. + desktop = os.path.normpath(os.path.expanduser('~/Desktop')) + for iter in range(3): + run_once(html_filename, runtime) + before = index() + if desktop in before: + break + + etime = time.time() + 5 # dont get stuck + while time.time() < etime and desktop not in before: + time.sleep(0.2) + before = index() + + print('has desktop:', desktop in before, iter) + + # Get all current files in home dir + before = index() + + # Run an app a few times + for i in range(n): + run_once(html_filename, runtime) + + # Get files that we have now + after = index() + + # Analyze + extra_files = after.difference(before) + extra_files2 = [f for f in extra_files + if not f.startswith((webruntime.TEMP_APP_DIR, + webruntime.RUNTIME_DIR))] + + print(extra_files2) + assert len(extra_files2) < n + + +def test_notrail_firefox(): + if not webruntime.FirefoxRuntime().is_available(): + skip('no firefox') + notrailtester('firefox-app') + + +def test_notrail_nw(): + if not webruntime.NWRuntime().is_available(): + skip('no nw') + notrailtester('nw-app') + + +if __name__ == '__main__': + test_notrail_firefox() + test_notrail_nw() + # run_tests_if_main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/webruntime/tests/test_runtime_functions.py new/webruntime-0.5.6/webruntime/tests/test_runtime_functions.py --- old/webruntime-0.5.4/webruntime/tests/test_runtime_functions.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/webruntime/tests/test_runtime_functions.py 2018-02-26 23:09:40.000000000 +0100 @@ -0,0 +1,53 @@ +""" Test some loose functions +""" + +from webruntime.util.testing import run_tests_if_main, raises, skipif + + +from webruntime._manage import versionstring +from webruntime import _expand_runtime_name + +def test_versionstring(): + + # Format + assert versionstring('10') .count('.') == 1 + assert versionstring('10.1') .count('.') == 2 + assert versionstring('10.1.2') .count('.') == 3 + + # Ignore empty parts + assert versionstring('10..1') == versionstring('10.1') + assert versionstring('10....1..2') == versionstring('10.1.2') + assert versionstring('10 . 1') == versionstring('10.1') + + # Allow recursion + assert versionstring('10.1') == versionstring(versionstring('10.1')) + + # Simple comparisons + assert versionstring('10') > versionstring('9') + assert versionstring('10.1') > versionstring('9.1') + assert versionstring('1.10') > versionstring('1.9') + assert versionstring('10.1') > versionstring('9.9') + assert versionstring('10.1.2.3.4.5.6') > versionstring('10.1.2.3.4.5.5') + + # Slightly trickier + assert versionstring('10.1.1') > versionstring('10.1') + assert versionstring('10.1.0') > versionstring('10.1') + + # Suffixes + assert versionstring('10.1') > versionstring('10.1.a') + assert versionstring('10.1') > versionstring('10.1a') + assert versionstring('10.1rc1') > versionstring('10.1a') + assert versionstring('10.1rc1') > versionstring('10.1.a') + assert versionstring('10.1rc2') > versionstring('10.1rc1') + + # Latest is special + assert versionstring('latest') > versionstring('999.999.999') + + + +def test_expand_runtime_name(): + assert 'nw-app' in _expand_runtime_name('app') + assert 'firefox-app' in _expand_runtime_name('app') + + +run_tests_if_main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/webruntime/tests/test_runtimes.py new/webruntime-0.5.6/webruntime/tests/test_runtimes.py --- old/webruntime-0.5.4/webruntime/tests/test_runtimes.py 1970-01-01 01:00:00.000000000 +0100 +++ new/webruntime-0.5.6/webruntime/tests/test_runtimes.py 2018-02-26 23:09:50.000000000 +0100 @@ -0,0 +1,146 @@ + +import os +import time +import tempfile +import subprocess + +from webruntime.util import icon + +from webruntime.util.testing import run_tests_if_main, raises, skipif + +from webruntime import BaseRuntime +from webruntime import launch +import webruntime + + +URL = None + +HTML = """ +<html> +<head> +<meta charset="utf-8"> +<style> + body {background: #00aa00;} +</style> +</head +<body></body> +</html> +""" + + +def setup_module(): + global URL, FILE + fname = os.path.join(tempfile.gettempdir(), 'webruntime_testpage.html') + with open(fname, 'wb') as f: + f.write(HTML.encode()) + URL = 'file://' + fname + + +def has_qt(): + try: + from PyQt4 import QtWebKit + except ImportError: + try: + from PySide import QtWebKit + except ImportError: + return False + return True + + +def has_nw(): + return webruntime.NWRuntime().is_available() + + +def has_chrome(): + return webruntime.ChromeRuntime().is_available() + + +## Misc + +def test_iconize(): + + # Default icon + icn = webruntime._common.iconize(None) + assert isinstance(icn, icon.Icon) + + fname = os.path.join(tempfile.gettempdir(), 'webruntime_testicon.ico') + icn.write(fname) + + # Load from file + icn = webruntime._common.iconize(fname) + assert isinstance(icn, icon.Icon) + + # Load from icon (noop) + assert webruntime._common.iconize(icn) is icn + + # Error + raises(ValueError, webruntime._common.iconize, []) + + +## Runtimes + + +@skipif(not has_qt(), reason='need qt') +def test_qtwebkit(): + p = launch(URL, 'pyqt-app') + assert p._proc + p.close() + + +def test_xul(): + p = launch(URL, 'firefox-app') + assert p._proc + + p.close() + p.close() # should do no harm + + +@skipif(not has_nw(), reason='need nw') +def test_nwjs(): + p = launch(URL, 'nw-app') + assert p._proc + p.close() + + +@skipif(not has_chrome(), reason='need chrome/chromium') +def test_chomeapp(): + p = launch(URL, 'chrome-app') + assert p._proc + p.close() + + +def test_browser(): + p = launch(URL, 'default-browser') + assert p._proc is None + + +def test_browser_ff(): + p = launch(URL, 'firefox-browser') + assert p._proc is None + + +#@skipif(os.getenv('TRAVIS') == 'true', reason='skip selenium on Travis') +@skipif(True, reason='meh selenium') +def test_selenium(): + p = launch(URL, 'selenium-firefox') + assert p._proc is None + assert p.driver + time.sleep(0.5) + p.close() + raises(ValueError, launch, URL, 'selenium') + + +def test_unknown(): + # Suppress dialog temporarily + import dialite + with dialite.NoDialogs(): + raises(ValueError, launch, URL, 'foo') + + +def test_default(): + p = launch(URL) + assert p.__class__.__name__ == 'FirefoxRuntime' + p.close() + + +run_tests_if_main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/webruntime.egg-info/PKG-INFO new/webruntime-0.5.6/webruntime.egg-info/PKG-INFO --- old/webruntime-0.5.4/webruntime.egg-info/PKG-INFO 2018-09-11 14:38:32.000000000 +0200 +++ new/webruntime-0.5.6/webruntime.egg-info/PKG-INFO 2018-12-03 16:33:42.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: webruntime -Version: 0.5.4 +Version: 0.5.6 Summary: Launch HTML5 apps in the browser or a desktop-like runtime. Home-page: http://webruntime.readthedocs.io Author: Almar Klein and contributors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webruntime-0.5.4/webruntime.egg-info/SOURCES.txt new/webruntime-0.5.6/webruntime.egg-info/SOURCES.txt --- old/webruntime-0.5.4/webruntime.egg-info/SOURCES.txt 2018-09-11 14:38:32.000000000 +0200 +++ new/webruntime-0.5.6/webruntime.egg-info/SOURCES.txt 2018-12-03 16:33:43.000000000 +0100 @@ -3,6 +3,15 @@ README.md setup.cfg setup.py +tasks/README.md +tasks/__init__.py +tasks/__main__.py +tasks/_config.py +tasks/clean.py +tasks/copyright.py +tasks/docs.py +tasks/help.py +tasks/test.py webruntime/__init__.py webruntime/__main__.py webruntime/_browser.py @@ -22,6 +31,9 @@ webruntime.egg-info/entry_points.txt webruntime.egg-info/requires.txt webruntime.egg-info/top_level.txt +webruntime/tests/test_dont_leave_trails.py +webruntime/tests/test_runtime_functions.py +webruntime/tests/test_runtimes.py webruntime/util/__init__.py webruntime/util/config.py webruntime/util/icon.py
