Skip to content

Commit

Permalink
Fix the failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
anshulagrawal2902 committed Jan 12, 2025
1 parent fcdcbd4 commit aea0e4e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions mslib/mswms/mswms.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

from mslib import __version__
from mslib.utils import setup_logging, LOGGER

from mslib.mswms.wms import app as application

def main():
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -88,7 +88,6 @@ def main():

# keep the import after the version check. This creates all layers.
from mslib.mswms.wms import mswms_settings, server
from mslib.mswms.wms import app as application

if args.action == "gallery":
if args.plot_types is None:
Expand Down
3 changes: 2 additions & 1 deletion mslib/mswms/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from mslib.index import create_app
from mslib.mswms.gallery_builder import add_image, write_html, add_levels, add_times, \
write_doc_index, write_code_pages, STATIC_LOCATION, DOCS_LOCATION
from mslib.utils import LOGGER
from mslib.utils import LOGGER, setup_logging

# Flask basic auth's documentation
# https://flask-basicauth.readthedocs.io/en/latest/#flask.ext.basicauth.BasicAuth.check_credentials
Expand Down Expand Up @@ -100,6 +100,7 @@ class default_mswms_settings:


mswms_settings = default_mswms_settings()
setup_logging()

try:
import mswms_settings as user_settings
Expand Down
4 changes: 4 additions & 0 deletions tests/_test_mswms/pytest.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2025-01-12 12:08:42 DEBUG FuncMMsH_pM3BxH0AAAB
2025-01-12 12:08:42 DEBUG Handling disconnect.
2025-01-12 12:08:42 DEBUG Disconnected: FuncMMsH_pM3BxH0AAAB
2025-01-12 12:08:42 DEBUG No user settings found, using default settings
3 changes: 2 additions & 1 deletion tests/_test_mswms/test_mswms.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import mock
import argparse
import pytest
import logging
from mslib.mswms import mswms


Expand All @@ -49,7 +50,7 @@ def test_main():

with mock.patch("mslib.mswms.mswms.argparse.ArgumentParser.parse_args",
return_value=argparse.Namespace(plot_types=None, version=False, update=False, gallery=False,
debug=False, logfile=None, action=None,
loglevel=logging.INFO, logfile=None, action=None,
host=None, port=None)):
mswms.main()
assert pytest_wrapped_e.typename == "SystemExit"

0 comments on commit aea0e4e

Please sign in to comment.