-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ZihengSun/main
sync
- Loading branch information
Showing
14 changed files
with
173 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
GEOWEAVER_DEFAULT_ENDPOINT_URL="http://localhost:8070/Geoweaver" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0", "wheel"] | ||
requires = ["setuptools>=61.0", "wheel", "pytest-cov"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "pygeoweaver" | ||
version = "0.6.5" | ||
version = "0.6.6" | ||
authors = [ | ||
{ name="Geoweaver team", email="[email protected]" }, | ||
] | ||
|
@@ -22,7 +22,7 @@ classifiers = [ | |
|
||
[tool.poetry] | ||
name = "pygeoweaver" | ||
version = "0.6.2" | ||
version = "0.6.6" | ||
description = "This is a wrapper package of the Geoweaver app." | ||
authors = ["Geoweaver team <[email protected]>"] | ||
readme = "README.md" | ||
|
@@ -34,3 +34,6 @@ setuptools = ">=61.0" | |
requests = "2.28.2" | ||
|
||
[tool.poetry.scripts] | ||
|
||
[tool.pytest.ini_options] | ||
addopts = "-p no:warnings --cov=pygeoweaver --cov-report=html" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
|
||
from io import StringIO | ||
import sys | ||
import unittest | ||
from pygeoweaver.sc_detail import detail_host, detail_process, detail_workflow | ||
from pygeoweaver.utils import get_logger | ||
|
||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
def test_detail_process(capfd): | ||
detail_process("not_existing_id") | ||
output, err = capfd.readouterr() | ||
logger.debug("stdout_output"+output) | ||
assert "No process found with id: not_existing_id" in output | ||
|
||
|
||
def test_detail_workflow(capfd): | ||
detail_workflow("not_existing_id") | ||
output, err = capfd.readouterr() | ||
logger.debug("stdout_output"+output) | ||
assert "No workflow found with id: not_existing_id" in output | ||
|
||
|
||
def test_detail_host(capfd): | ||
detail_host("not_existing_id") | ||
output, err = capfd.readouterr() | ||
logger.debug("stdout_output"+output) | ||
assert "No host found with id: not_existing_id" in output | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
The main function of pygeoweaver | ||
To run in CLI mode. | ||
""" | ||
import logging | ||
from unittest.mock import patch | ||
import requests | ||
from pygeoweaver import start, stop | ||
|
||
import unittest | ||
|
||
from pygeoweaver.constants import GEOWEAVER_DEFAULT_ENDPOINT_URL | ||
from pygeoweaver.server import show | ||
from pygeoweaver.utils import get_logger | ||
|
||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
|
||
class TestServer(unittest.TestCase): | ||
|
||
def test_server_start_stop(self): | ||
start() | ||
response = requests.get(GEOWEAVER_DEFAULT_ENDPOINT_URL) | ||
self.assertEqual(response.status_code, 200, f"Failed to access URL: {GEOWEAVER_DEFAULT_ENDPOINT_URL}") | ||
stop() | ||
with self.assertRaises(requests.exceptions.ConnectionError): | ||
response = requests.get(GEOWEAVER_DEFAULT_ENDPOINT_URL) | ||
|
||
stop() # stop again should have no issue | ||
|
||
|
||
def test_windows(self): | ||
with patch('pygeoweaver.server.checkOS') as mock_checkos: | ||
mock_checkos.return_value = 3 | ||
with self.assertRaises(RuntimeError): | ||
start() | ||
with self.assertRaises(RuntimeError): | ||
stop() | ||
|
||
def test_show_gui(self): | ||
with patch('pygeoweaver.webbrowser.open') as mock_browser_open: | ||
show() | ||
mock_browser_open.assert_called_once() | ||
|
||
with patch('pygeoweaver.server.checkIPython') as mock_checkipython: | ||
mock_checkipython.return_value = True | ||
show() | ||
mock_browser_open.assert_called_once() | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |