# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
-OUTPUT=$(TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto)
-printf "$OUTPUT"
+set -e
+echo Launching tox
+tox --parallel=auto
+echo "Checking the presence of release notes ..."
+nb_rn=$(git diff --diff-filter=A --name-only HEAD~1 |grep "releasenotes\/notes" |wc -l)
+if [ "${nb_rn}" -lt 1 ]; then
+ echo "The commit needs release notes"
+ echo "Run the following command to generate release notes: tox -e release_notes '<release_note_title>'"
+ echo "Please read README.md for more details"
+ exit 1
+elif [ "${nb_rn}" -gt 1 ]; then
+ echo "Only one release notes file should be added in a commit"
+ exit 1
+fi
+echo "OK. Release notes present in commit"
# See the License for the specific language governing permissions and
# limitations under the License.
-import yaml
+from base64 import b64decode, b64encode
+from copy import deepcopy
+from http import HTTPStatus
import logging
import re
-from http import HTTPStatus
-from copy import deepcopy
+from threading import Lock
+
from Crypto.Cipher import AES
-from base64 import b64decode, b64encode
from osm_common.common_utils import FakeLock
-from threading import Lock
+import yaml
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# See the License for the specific language governing permissions and
# limitations under the License.
-import logging
-from osm_common.dbbase import DbException, DbBase
-from osm_common.dbmongo import deep_update
+from copy import deepcopy
from http import HTTPStatus
+import logging
from uuid import uuid4
-from copy import deepcopy
+
+from osm_common.dbbase import DbBase, DbException
+from osm_common.dbmongo import deep_update
+
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# limitations under the License.
-import logging
-from pymongo import MongoClient, errors
-from osm_common.dbbase import DbException, DbBase
-from http import HTTPStatus
-from time import time, sleep
-from copy import deepcopy
from base64 import b64decode
+from copy import deepcopy
+from http import HTTPStatus
+import logging
+from time import sleep, time
from uuid import uuid4
+from osm_common.dbbase import DbBase, DbException
+from pymongo import errors, MongoClient
+
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# TODO consider use this decorator for database access retries
# limitations under the License.
-import logging
from http import HTTPStatus
-from osm_common.common_utils import FakeLock
+import logging
from threading import Lock
+from osm_common.common_utils import FakeLock
+
+
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# See the License for the specific language governing permissions and
# limitations under the License.
+from http import HTTPStatus
+import logging
import os
+from shutil import rmtree
import tarfile
import zipfile
-import logging
-# import tarfile
-from http import HTTPStatus
-from shutil import rmtree
from osm_common.fsbase import FsBase, FsException
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# For those usages not covered by the Apache License, Version 2.0 please
# contact: eduardo.sousa@canonical.com
##
-
+import datetime
import errno
from http import HTTPStatus
from io import BytesIO, StringIO
import logging
import os
-import datetime
import tarfile
import zipfile
-from gridfs import GridFSBucket, errors
+from gridfs import errors, GridFSBucket
from osm_common.fsbase import FsBase, FsException
from pymongo import MongoClient
# See the License for the specific language governing permissions and
# limitations under the License.
-import logging
from http import HTTPStatus
-from osm_common.common_utils import FakeLock
+import logging
from threading import Lock
+from osm_common.common_utils import FakeLock
+
__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
# See the License for the specific language governing permissions and
# limitations under the License.
-import logging
import asyncio
-import yaml
+import logging
+
from aiokafka import AIOKafkaConsumer
from aiokafka import AIOKafkaProducer
from aiokafka.errors import KafkaError
from osm_common.msgbase import MsgBase, MsgException
+import yaml
__author__ = (
"Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>, "
# See the License for the specific language governing permissions and
# limitations under the License.
+import asyncio
+from http import HTTPStatus
import logging
import os
-import yaml
-import asyncio
-from osm_common.msgbase import MsgBase, MsgException
from time import sleep
-from http import HTTPStatus
-__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
+from osm_common.msgbase import MsgBase, MsgException
+import yaml
+__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
"""
This emulated kafka bus by just using a shared file system. Useful for testing or devops.
One file is used per topic. Only one producer and one consumer is allowed per topic. Both consumer and producer
└── charm.py
"""
-import yaml
import datetime
import os
+
+import yaml
+
from .sol_package import SOLPackage
└── charm.py
"""
-import yaml
import datetime
import os
+
+import yaml
+
from .sol_package import SOLPackage
# For those usages not covered by the Apache License, Version 2.0 please
# contact: fbravo@whitestack.com or agarcia@whitestack.com
##
-
+import hashlib
import os
+
import yaml
-import hashlib
class SOLPackageException(Exception):
# under the License.
##
-import sys
import subprocess
+import sys
from ops.charm import CharmBase
from ops.main import main
# under the License.
##
-import sys
import subprocess
+import sys
from ops.charm import CharmBase
from ops.main import main
# under the License.
##
-import sys
import subprocess
+import sys
from ops.charm import CharmBase
from ops.main import main
##
import http
-import pytest
+from http import HTTPStatus
+from os import urandom
import unittest
+
from osm_common.dbbase import DbBase, DbException, deep_update
-from os import urandom
-from http import HTTPStatus
+import pytest
def exception_message(message):
TEST = (
("plain text 1 ! ", None),
("plain text 2 with salt ! ", "1afd5d1a-4a7e-4d9c-8c65-251290183106"),
- ("plain text 3 with usalt ! ", u"1afd5d1a-4a7e-4d9c-8c65-251290183106"),
- (u"plain unicode 4 ! ", None),
- (u"plain unicode 5 with salt ! ", "1a000d1a-4a7e-4d9c-8c65-251290183106"),
- (u"plain unicode 6 with usalt ! ", u"1abcdd1a-4a7e-4d9c-8c65-251290183106"),
)
for db_base in self.db_bases:
for value, salt in TEST:
# For those usages not covered by the Apache License, Version 2.0 please
# contact: esousa@whitestack.com or alfonso.tiernosepulveda@telefonica.com
##
-
+from copy import deepcopy
import http
import logging
-import pytest
import unittest
-from unittest.mock import Mock
+from unittest.mock import MagicMock, Mock
-from unittest.mock import MagicMock
from osm_common.dbbase import DbException
from osm_common.dbmemory import DbMemory
-from copy import deepcopy
+import pytest
__author__ = "Eduardo Sousa <eduardosousa@av.it.pt>"
##
import http
-import pytest
from osm_common.fsbase import FsBase, FsException
+import pytest
def exception_message(message):
# contact: esousa@whitestack.com or alfonso.tiernosepulveda@telefonica.com
##
+import http
import io
import logging
-import http
import os
-import pytest
+import shutil
import tarfile
import tempfile
import uuid
-import shutil
from osm_common.fsbase import FsException
from osm_common.fslocal import FsLocal
+import pytest
__author__ = "Eduardo Sousa <eduardosousa@av.it.pt>"
# contact: eduardo.sousa@canonical.com
##
+from io import BytesIO
import logging
-import pytest
-import tempfile
-import tarfile
import os
+from pathlib import Path
import subprocess
-
-from pymongo import MongoClient
-from gridfs import GridFSBucket
-
-from io import BytesIO
-
+import tarfile
+import tempfile
from unittest.mock import Mock
+from gridfs import GridFSBucket
from osm_common.fsbase import FsException
from osm_common.fsmongo import FsMongo
-from pathlib import Path
+from pymongo import MongoClient
+import pytest
__author__ = "Eduardo Sousa <eduardo.sousa@canonical.com>"
##
import http
-import pytest
from osm_common.msgbase import MsgBase, MsgException
+import pytest
def exception_message(message):
import http
import logging
-import pytest
-import tempfile
-import shutil
-import uuid
import os
-import yaml
-import time
+import shutil
+import tempfile
import threading
-
+import time
from unittest.mock import MagicMock
+import uuid
+
from osm_common.msgbase import MsgException
from osm_common.msglocal import MsgLocal
+import pytest
+import yaml
__author__ = "Eduardo Sousa <eduardosousa@av.it.pt>"
--- /dev/null
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+---
+other:
+ - |
+ Flake8 import order check is added in tox.ini, library import order is arranged in all files.
+ Release note creation is added in tox.ini, stage-test failing by tox results is enabled, release note
+ checking script is added.
\ No newline at end of file
import os
+
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps =
+ flake8
+ flake8-import-order
commands =
flake8 osm_common/ setup.py
sh -c 'rm osm_common/requirements.txt'
whitelist_externals = sh
+#######################################################################################
+[testenv:release_notes]
+deps = reno
+skip_install = true
+whitelist_externals = bash
+commands =
+ reno new {posargs:new_feature}
+ bash -c "sed -i -e '1 e head -16 tox.ini' releasenotes/notes/{posargs:new_feature}*.yaml"
+
#######################################################################################
[flake8]
ignore =
max-line-length = 120
show-source = True
builtins = _
+import-order-style = google