Skip to content

Commit

Permalink
reset branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ninsbl committed Oct 5, 2021
1 parent 255beae commit 2160576
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions scripts/g.extension/testsuite/test_addons_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@
"""

import os
import imp
from importlib.machinery import SourceFileLoader
from distutils.spawn import find_executable
import unittest

from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.utils import silent_rmtree

# Set to False if test is supposed to run
skip = True


class TestModuleDownloadFromDifferentSources(TestCase):

Expand All @@ -53,7 +49,6 @@ def tearDown(self):
"""Remove created files"""
silent_rmtree(self.install_prefix)

@unittest.skipIf(skip, "Skipping as chosen...")
def test_github_install(self):
"""Test installing extension from github"""

Expand All @@ -70,13 +65,11 @@ def test_github_install(self):
extension="r.example.plus",
url="https://github.com/wenzeslaus/r.example.plus",
prefix=self.install_prefix,
branch="main",
)

for file in self.files:
self.assertFileExists(file)

@unittest.skipIf(skip, "Skipping as chosen...")
def test_gitlab_install(self):
"""Test installing extension from gitlab"""
self.assertModule(
Expand All @@ -89,7 +82,6 @@ def test_gitlab_install(self):
for file in self.files:
self.assertFileExists(file)

@unittest.skipIf(skip, "Skipping as chosen...")
def test_bitbucket_install(self):
"""Test installing extension from bitbucket"""
d_rast_files = [
Expand All @@ -106,21 +98,17 @@ def test_bitbucket_install(self):
for file in d_rast_files:
self.assertFileExists(file)

@unittest.skipIf(skip, "Skipping as chosen...")
def test_github_install_official(self):
"""Test installing extension from official addons repository"""
r_clip_files = [
os.path.join(self.install_prefix, "scripts", "r.clip"),
os.path.join(self.install_prefix, "docs", "html", "r.clip.html"),
"""Test installing C-extension from official addons repository"""
r_gdd_files = [
os.path.join(self.install_prefix, "bin", "r.gdd"),
os.path.join(self.install_prefix, "docs", "html", "r.gdd.html"),
]
self.assertModule(
"g.extension", extension="v.in.gbif", url=None, prefix=self.install_prefix
)
self.assertModule("g.extension", extension="r.gdd", prefix=self.install_prefix)

for file in r_clip_files:
for file in r_gdd_files:
self.assertFileExists(file)

@unittest.skipIf(skip, "Skipping as chosen...")
def test_github_install_official_multimodule(self):
"""Test installing multi-module extension from official addons repository"""
i_sentinel_files = [
Expand All @@ -134,7 +122,7 @@ def test_github_install_official_multimodule(self):
os.path.join(self.install_prefix, "docs", "html", "i.sentinel.import.html"),
]
self.assertModule(
"g.extension", extension="i.sentinel", url=None, prefix=self.install_prefix
"g.extension", extension="i.sentinel", prefix=self.install_prefix
)

for file in i_sentinel_files:
Expand All @@ -143,7 +131,6 @@ def test_github_install_official_multimodule(self):
print(file)
self.assertModule(file, **{"help": True})

@unittest.skipIf(skip, "Skipping as chosen...")
def test_windows_install(self):
"""Test function for installing extension on MS Windows"""

Expand All @@ -158,7 +145,7 @@ def test_windows_install(self):
),
]
g_extension_path = find_executable("g.extension")
g_extension = imp.load_source("g.extension", g_extension_path)
g_extension = SourceFileLoader("g.extension", g_extension_path).load_module()
g_extension.options = {
"extension": "v.in.gbif",
"operation": "add",
Expand Down

0 comments on commit 2160576

Please sign in to comment.