From a81231932b864f0bbb7bc293a1b8257b6020ce91 Mon Sep 17 00:00:00 2001 From: Galileo Sartor Date: Fri, 4 Sep 2020 15:57:35 +0200 Subject: [PATCH] Add url test file --- .github/workflows/url_tests.yml | 28 +++ runtests | 2 + setup.cfg | 2 +- tests/large/test_urls.py | 324 ++++++++++++++++++++++++++++++++ umake/frameworks/crystal.py | 19 +- umake/frameworks/games.py | 8 +- umake/frameworks/ide.py | 2 +- 7 files changed, 369 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/url_tests.yml create mode 100644 tests/large/test_urls.py diff --git a/.github/workflows/url_tests.yml b/.github/workflows/url_tests.yml new file mode 100644 index 00000000..cfdd4e22 --- /dev/null +++ b/.github/workflows/url_tests.yml @@ -0,0 +1,28 @@ +name: small_tests + +on: + push: + pull_request: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '* * 1 * *' + + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install dependencies + run: | + sudo apt install gir1.2-gtk-3.0 libgirepository1.0-dev libapt-pkg-dev fakeroot + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Test with pytest + run: | + ./runtests tests/large/test_urls.py diff --git a/runtests b/runtests index 7e12ba67..5e343b0a 100755 --- a/runtests +++ b/runtests @@ -86,6 +86,8 @@ def local_run(args): if len(args.tests) > 0: for test_type in args.tests: + if "test_urls" in test_type: + pytest_args.extend(["-n 4"]) for named_test_type in ("small", "medium", "large", "pep8"): if test_type == named_test_type: if test_type == "pep8": diff --git a/setup.cfg b/setup.cfg index bcfc448c..3474fb79 100755 --- a/setup.cfg +++ b/setup.cfg @@ -22,4 +22,4 @@ max-line-length = 120 ignore = E111, E722, W504 [tool:pytest] -addopts = -v --maxfail 1 \ No newline at end of file +addopts = -v \ No newline at end of file diff --git a/tests/large/test_urls.py b/tests/large/test_urls.py new file mode 100644 index 00000000..aaec7045 --- /dev/null +++ b/tests/large/test_urls.py @@ -0,0 +1,324 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2014 Canonical +# +# Authors: +# Didier Roche +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +"""Tests for large base installer framework""" + +from . import LargeFrameworkTests + +from ..tools import UMAKE, spawn_process + + +class UrlFetchTests(LargeFrameworkTests): + """This will test the base installer framework via a fake one""" + + @classmethod + def setUpClass(cls): + super().setUpClass() + + @classmethod + def tearDownClass(cls): + super().tearDownClass() + + def setUp(self): + super().setUp() + + def test_android_ndk_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} android android-ndk --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_android_platform_tools_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} android android-platform-tools --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_android_sdk_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} android android-sdk --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_android_studio_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} android android-studio --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_crystal_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} crystal crystal-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_dart_sdk_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} dart dart-sdk --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_flutter_sdk_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} dart flutter-sdk --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_terraform_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} devops terraform --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_arduino_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} electronics arduino --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_eagle_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} electronics eagle --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_fritzing_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} electronics fritzing --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_blender_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} games blender --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_godot_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} games godot --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_stencyl_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} games stencyl --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_superpowers_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} games superpowers --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_twine_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} games twine --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_go_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} go go-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_atom_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide atom --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_clion_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide clion --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_dbeaver_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide dbeaver --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_datagrip_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide datagrip --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_eclipse_cpp_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide eclipse-cpp --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_eclipse_jee_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide eclipse-jee --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_eclipse_javascript_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide eclipse-javascript --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_eclipse_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide eclipse --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_eclipse_php_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide eclipse-php --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_goland_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide goland --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_idea_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide idea --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_idea_ultimate_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide idea-ultimate --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_lighttable_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide lighttable --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_liteide_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide liteide --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_netbeans_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide netbeans --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_phpstorm_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide phpstorm --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_processing_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide processing --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_pycharm_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide pycharm --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_pycharm_educational_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide pycharm-educational --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_pycharm_professional_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide pycharm-professional --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_rstudio_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide rstudio --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_rider_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide rider --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_rubymine_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide rubymine --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_spring_tools_suite_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide spring-tools-suite --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_sublime_text_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide sublime-text --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_vscodium_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide vscodium --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_visual_studio_code_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide visual-studio-code --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_webstorm_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} ide webstorm --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_adoptopenjdk_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} java adoptopenjdk --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_openjfx_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} java openjfx --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_kotlin_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} kotlin kotlin-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_maven_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} maven maven-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_nodejs_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} nodejs nodejs-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_rust_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} rust rust-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_scala_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} scala scala-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_swift_lang_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} swift swift-lang --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_chromedriver_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} web chromedriver --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_firefox_dev_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} web firefox-dev --lang en-US --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_geckodriver_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} web geckodriver --dry-run')) + self.expect_and_no_warn("Found download URL:.*") + + def test_phantomjs_install(self): + """Install base installer from scratch test case""" + self.child = spawn_process(self.command(f'{UMAKE} web phantomjs --dry-run')) + self.expect_and_no_warn("Found download URL:.*") diff --git a/umake/frameworks/crystal.py b/umake/frameworks/crystal.py index aee5f647..31aa84bb 100644 --- a/umake/frameworks/crystal.py +++ b/umake/frameworks/crystal.py @@ -44,15 +44,16 @@ def __init__(self, **kwargs): super().__init__(name="Crystal Lang", description=_("Crystal compiler (default)"), is_category_default=True, only_on_archs=['i386', 'amd64'], download_page="https://api.github.com/repos/crystal-lang/crystal/releases/latest", - packages_requirements=["libbsd-dev", "libedit-dev", "libevent-dev", - "libevent-core-2.0-5 | libevent-core-2.1-6 | libevent-core-2.1-7", - "libevent-extra-2.0-5 | libevent-extra-2.1-6 | libevent-extra-2.1-7", - "libevent-openssl-2.0-5 | libevent-openssl-2.1-6 | libevent-openssl-2.1-7", - "libevent-pthreads-2.0-5 | libevent-pthreads-2.1-6 | libevent-pthreads-2.1-7", - "libgmp-dev", "libgmpxx4ldbl", "libssl-dev", - "libxml2-dev", "libyaml-dev", "libreadline-dev", - "automake", "libtool", "llvm", "libpcre3-dev", - "build-essential", "libgc-dev"], + packages_requirements=[ + "libbsd-dev", "libedit-dev", "libevent-dev", + "libevent-core-2.0-5 | libevent-core-2.1-6 | libevent-core-2.1-7", + "libevent-extra-2.0-5 | libevent-extra-2.1-6 | libevent-extra-2.1-7", + "libevent-openssl-2.0-5 | libevent-openssl-2.1-6 | libevent-openssl-2.1-7", + "libevent-pthreads-2.0-5 | libevent-pthreads-2.1-6 | libevent-pthreads-2.1-7", + "libgmp-dev", "libgmpxx4ldbl", "libssl-dev", + "libxml2-dev", "libyaml-dev", "libreadline-dev", + "automake", "libtool", "llvm", "libpcre3-dev", + "build-essential", "libgc-dev"], dir_to_decompress_in_tarball="crystal-*", required_files_path=[os.path.join("bin", "Crystal")], json=True, **kwargs) diff --git a/umake/frameworks/games.py b/umake/frameworks/games.py index 3f949484..e43c7ce4 100644 --- a/umake/frameworks/games.py +++ b/umake/frameworks/games.py @@ -20,7 +20,6 @@ """Game IDEs module""" -from concurrent import futures from contextlib import suppress from gettext import gettext as _ import logging @@ -32,7 +31,6 @@ import umake.frameworks.baseinstaller from umake.network.download_center import DownloadItem, DownloadCenter from umake.tools import as_root, create_launcher, get_application_desktop_file, get_current_arch -from umake.ui import UI logger = logging.getLogger(__name__) @@ -123,9 +121,9 @@ def _chrome_sandbox_setuid(path): class Unity3D(umake.frameworks.baseinstaller.BaseInstaller): - def __init__(self, **kwargs): - super().__init__(name="Unity3D", description="For removal only (tarfile not supported upstream anymore)", - download_page=None, only_on_archs=['amd64'], only_for_removal=True, **kwargs) + def __init__(self, **kwargs): + super().__init__(name="Unity3D", description="For removal only (tarfile not supported upstream anymore)", + download_page=None, only_on_archs=['amd64'], only_for_removal=True, **kwargs) class Twine(umake.frameworks.baseinstaller.BaseInstaller): diff --git a/umake/frameworks/ide.py b/umake/frameworks/ide.py index 1a20437d..89e17ded 100644 --- a/umake/frameworks/ide.py +++ b/umake/frameworks/ide.py @@ -839,7 +839,7 @@ def __init__(self, **kwargs): super().__init__(name="RStudio", description=_("RStudio code editor"), only_on_archs=['amd64'], download_page="https://www.rstudio.com/products/rstudio/download/", - # packages_requirements=["libjpeg62", "libedit2", "libssl1.0.0 | libssl1.1", "libclang-dev"], + packages_requirements=["libjpeg62", "libedit2", "libssl1.0.0 | libssl1.1", "libclang-dev"], desktop_filename="rstudio.desktop", required_files_path=["bin/rstudio"], dir_to_decompress_in_tarball="rstudio-*",