Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gsoc develop merge 4 #1169

Merged
merged 12 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
run: |
source /opt/conda/bin/activate mssenv \
&& cd $GITHUB_WORKSPACE \
&& pytest -v --durations=20 --cov=mslib mslib \
&& pytest -v --durations=20 --reverse --cov=mslib mslib \
|| (for i in {1..5} \
; do pytest mslib -v --durations=0 --last-failed --lfnf=none \
; do pytest mslib -v --durations=0 --reverse --last-failed --lfnf=none \
&& break \
; done)

Expand Down
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

Version 5.0.1
~~~~~~~~~~~~~

Bug fix release

All changes:
https://github.com/Open-MSS/MSS/milestone/64?closed=1

Version 5.0.0
~~~~~~~~~~~~~

Expand Down
7 changes: 4 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ If you do prefer to use over 7K open-source packages install Anaconda.

We recommend to install this for the local user. This does not require administrator permissions.


As **Beginner** start with an installation of Miniconda
- `Get Miniconda <https://docs.conda.io/projects/conda/en/latest/user-guide/install/>`_
- `Get Anaconda <https://docs.continuum.io/anaconda/install/>`_
- `Get Miniforge <https://github.com/conda-forge/miniforge/>`_

If you are an Advanced User you know that `Anaconda <https://docs.continuum.io/anaconda/install/>`_
or `Miniforge <https://github.com/conda-forge/miniforge/>`_ are compatible too.


conda-forge channel
Expand Down
2 changes: 2 additions & 0 deletions docs/samples/config/wms/mss_wms_settings.py.chem_plots
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ import mss_chem_plots
#base_dir = os.path.abspath(os.path.dirname(mslib.mswms.__file__))
#xml_template_location = os.path.join(base_dir, "xml_templates")

# Path to store an optional gallery
_gallerypath = r"/path/to/data/mss/gallery"
_datapath = r"/path/to/data/mss/testdata"

data = {
Expand Down
2 changes: 2 additions & 0 deletions docs/samples/config/wms/mss_wms_settings.py.demodata
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ import mslib.mswms
#base_dir = os.path.abspath(os.path.dirname(mslib.mswms.__file__))
#xml_template_location = os.path.join(base_dir, "xml_templates")

# Path to store an optional gallery
_gallerypath = r"/path/to/data/mss/gallery"
_datapath = r"/path/to/data/mss/testdata"

data = {
Expand Down
2 changes: 2 additions & 0 deletions docs/samples/config/wms/mss_wms_settings.py.sample
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import mslib.mswms
# SETTINGS ###
#

# Path to store an optional gallery
_gallerypath = r"/path/to/data/mss/gallery"

# Paths to data directories. Process callables (the functions that are
# executed by the dispatcher system) can access these paths, hence
Expand Down
14 changes: 5 additions & 9 deletions localbuild/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,10 @@ requirements:
- fs_filepicker
- cftime >=1.0.1
- matplotlib >=3.3.2
- flask <2.0.0
- jinja2 <3.0.0
- click <8.0.o
- itsdangerous <2.0.0
- markupsafe <2.0.0
- flask >=2.0.0
- flask-httpauth
- werkzeug <2.0.0
- flask-socketio >=4.3.1, <5
- werkzeug >2.0.0
- flask-socketio >=5
- flask-sqlalchemy
- passlib
- gitpython
Expand All @@ -69,8 +65,8 @@ requirements:
- validate_email
- multidict
- pint
- python-socketio >=4.4.0, <5
- python-engineio >=3.13.2, <4
- python-socketio >=5
- python-engineio >=4
- markdown
- xstatic
- xstatic-jquery
Expand Down
2 changes: 2 additions & 0 deletions mslib/mscolab/_tests/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def test_get_messages(self):
sio.connect(self.url)
sio.emit('start', response)
sio.sleep(2)
# ToDo same message gets twice emmitted, why? (use a helper function)
sio.emit("chat-message", {
"p_id": 1,
"token": response['token'],
Expand Down Expand Up @@ -147,6 +148,7 @@ def test_get_messages_api(self):
sio.connect(self.url)
sio.emit('start', response)
sio.sleep(2)
# ToDo same message gets twice emmitted, why?
sio.emit("chat-message", {
"p_id": 1,
"token": response['token'],
Expand Down
97 changes: 42 additions & 55 deletions mslib/mscolab/_tests/test_chat_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,77 +24,64 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import os
import requests
import json
import sys
import pytest

from werkzeug.urls import url_join
from PyQt5 import QtWidgets, QtTest
from mslib.mscolab.models import User, MessageType, Message
from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab.chat_manager import ChatManager
from mslib._tests.utils import mscolab_start_server
import mslib.msui.mss_pyui as mss_pyui


PORTS = list(range(9321, 9340))
from flask_testing import TestCase


@pytest.mark.skipif(os.name == "nt",
reason="multiprocessing needs currently start_method fork")
class Test_Chat_Manager(object):
def setup(self):
self.process, self.url, self.app, _, self.cm, self.fm = mscolab_start_server(PORTS)
QtTest.QTest.qWait(500)
self.application = QtWidgets.QApplication(sys.argv)
self.window = mss_pyui.MSSMainWindow(mscolab_data_dir=mscolab_settings.MSCOLAB_DATA_DIR)
self.cm = ChatManager()
from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab.models import Message, MessageType
from mslib.mscolab.mscolab import handle_db_reset
from mslib.mscolab.server import APP
from mslib.mscolab.seed import add_user, get_user, add_project, add_user_to_project
from mslib.mscolab.sockets_manager import setup_managers


class Test_Chat_Manager(TestCase):
render_templates = False

def create_app(self):
app = APP
app.config['SQLALCHEMY_DATABASE_URI'] = mscolab_settings.SQLALCHEMY_DB_URI
app.config['MSCOLAB_DATA_DIR'] = mscolab_settings.MSCOLAB_DATA_DIR
app.config['UPLOAD_FOLDER'] = mscolab_settings.UPLOAD_FOLDER
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config["TESTING"] = True
app.config['LIVESERVER_TIMEOUT'] = 10
app.config['LIVESERVER_PORT'] = 0
return app

def setUp(self):
handle_db_reset()
self.userdata = 'UV10@uv10', 'UV10', 'uv10'
self.anotheruserdata = 'UV20@uv20', 'UV20', 'uv20'
self.room_name = "europe"
data = {
'email': 'a',
'password': 'a'
}
r = requests.post(self.url + '/token', data=data)
self.token = json.loads(r.text)['token']
with self.app.app_context():
self.user = User.query.filter_by(id=8).first()

data = {
"token": self.token,
"path": self.room_name,
"description": "test description"
}
url = url_join(self.url, 'create_project')
requests.post(url, data=data)

def teardown(self):
if self.window.mscolab.version_window:
self.window.mscolab.version_window.close()
if self.window.mscolab.conn:
self.window.mscolab.conn.disconnect()
self.application.quit()
QtWidgets.QApplication.processEvents()
self.process.terminate()
socketio, self.cm, self.fm = setup_managers(self.app)
assert add_user(self.userdata[0], self.userdata[1], self.userdata[2])
assert add_project(self.room_name, "test europe")
assert add_user_to_project(path=self.room_name, emailid=self.userdata[0])
self.user = get_user(self.userdata[0])

def tearDown(self):
pass

def test_add_message(self):
with self.app.app_context():
message = self.cm.add_message(self.user, 'some message', self.room_name, message_type=MessageType.TEXT,
with self.app.test_client():
message = self.cm.add_message(self.user, 'some message',
self.room_name, message_type=MessageType.TEXT,
reply_id=None)
assert message.text == 'some message'

def test_edit_messages(self):
with self.app.app_context():
message = self.cm.add_message(self.user, 'some test message', self.room_name, message_type=MessageType.TEXT,
with self.app.test_client():
message = self.cm.add_message(self.user, 'some test message',
self.room_name, message_type=MessageType.TEXT,
reply_id=None)
new_message_text = "Wonderland"
self.cm.edit_message(message.id, new_message_text)
message = Message.query.filter_by(id=message.id).first()
assert message.text == new_message_text

def test_delete_messages(self):
with self.app.app_context():
with self.app.test_client():
message = self.cm.add_message(self.user, 'some test example message',
self.room_name, message_type=MessageType.TEXT,
reply_id=None)
Expand Down
Loading