Skip to content

Commit

Permalink
Merge pull request #75 from melexis/namespace
Browse files Browse the repository at this point in the history
Change namespace from `mlx` to `mlx/coverity`
  • Loading branch information
JasperCraeghs authored Aug 23, 2024
2 parents 8f23ea8 + 030f7e5 commit 85a6d8f
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ tests/docs/autodoc/docs/_build
.coverage
coverage.xml
.env
mlx/coverity/__coverity_version__.py
7 changes: 2 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Include the readme file
include README.rst

# Include the assets - javascript
# include mlx/assets/*.js


# added by check_manifest.py
include LICENSE
include NOTICE
include tox.ini
recursive-include mlx *.py
recursive-include mlx/coverity *.py
exclude mlx/coverity/__coverity_version__.py
recursive-include example *.bat
recursive-include example *.py
recursive-include example *.rst
Expand Down
4 changes: 2 additions & 2 deletions example/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import sys

import mlx.coverity
from mlx.coverity import __version__
import mlx.traceability
from decouple import config
import logging
from sphinx.util.logging import getLogger
from pkg_resources import get_distribution

pkg_version = get_distribution("mlx.coverity").version
pkg_version = __version__

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
3 changes: 0 additions & 3 deletions mlx/__init__.py

This file was deleted.

21 changes: 21 additions & 0 deletions mlx/coverity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
""" Melexis sphinx coverity extention """

__all__ = [
"CoverityDefect",
"CoverityDefectListDirective",
"CoverityDefectService",
"ItemElement",
"report_info",
"report_warning",
"SphinxCoverityConnector",
]

from .__coverity_version__ import __version__
from .coverity_logging import report_info, report_warning
from .coverity import SphinxCoverityConnector
from .coverity_services import CoverityDefectService
from .coverity_item_element import ItemElement
from .coverity_directives.coverity_defect_list import CoverityDefect, CoverityDefectListDirective

# provide setup function here for Sphinx
from .coverity import setup # noqa: F401
10 changes: 5 additions & 5 deletions mlx/coverity.py → mlx/coverity/coverity.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
from urllib.error import URLError, HTTPError

from docutils import nodes
import pkg_resources

from mlx.coverity_logging import report_info, report_warning
from mlx.coverity_services import CoverityDefectService
from mlx.coverity_directives.coverity_defect_list import (
from .__coverity_version__ import __version__
from .coverity_logging import report_info, report_warning
from .coverity_services import CoverityDefectService
from .coverity_directives.coverity_defect_list import (
CoverityDefect,
CoverityDefectListDirective,
)
Expand Down Expand Up @@ -177,7 +177,7 @@ def setup(app):
app.connect("builder-inited", sphinx_coverity_connector.initialize_environment)

try:
version = pkg_resources.require("mlx.coverity")[0].version
version = __version__
except LookupError:
version = "dev"
return {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
mpl.use("Agg")
import matplotlib.pyplot as plt

from mlx.coverity_logging import report_info, report_warning
from mlx.coverity_item_element import ItemElement
from ..coverity_logging import report_info, report_warning
from ..coverity_item_element import ItemElement


def pct_wrapper(sizes):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sphinx.errors import NoUri
from urlextract import URLExtract

from mlx.coverity_logging import report_warning
from .coverity_logging import report_warning


class ItemElement(nodes.General, nodes.Element):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import requests
from sphinx.util.logging import getLogger

from mlx.coverity_logging import report_info
from mlx.coverity import report_info

# Coverity built in Impact statuses
IMPACT_LIST = ["High", "Medium", "Low"]
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[build-system]
requires = ["setuptools-scm", "setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "mlx/coverity/__coverity_version__.py"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ norecursedirs= .tox
exclude = .git,*conf.py,build,dist,tests/docs
max-line-length = 120
per-file-ignores =
mlx/coverity_directives/coverity_defect_list.py:E402
*/__init__.py: F401

[check-manifest]
ignore=
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from setuptools import setup, find_packages
from setuptools import setup, find_namespace_packages

project_url = "https://github.com/melexis/sphinx-coverity-extension"

Expand All @@ -16,7 +16,6 @@

setup(
name="mlx.coverity",
use_scm_version=True,
url=project_url,
license="GNU General Public License v3 (GPLv3)",
author="Crt Mori",
Expand Down Expand Up @@ -44,7 +43,8 @@
'Topic :: Utilities',
],
platforms="any",
packages=find_packages(exclude=["tests", "example"]),
packages=find_namespace_packages(where="."),
package_dir={"": "."},
include_package_data=True,
install_requires=requires,
python_requires='>=3.8',
Expand Down
5 changes: 2 additions & 3 deletions tests/test_coverity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from pathlib import Path
from parameterized import parameterized

from mlx.coverity import SphinxCoverityConnector, CoverityDefect
from mlx.coverity_services import CoverityDefectService
from mlx.coverity import SphinxCoverityConnector, CoverityDefect, CoverityDefectService
from .filters import test_defect_filter_0, test_defect_filter_1, test_defect_filter_2, test_defect_filter_3

TEST_FOLDER = Path(__file__).parent
Expand Down Expand Up @@ -72,7 +71,7 @@ def test_session_by_stream_validation(self):
stream_request = mocker.last_request
assert stream_request.headers["Authorization"] == requests.auth._basic_auth_str("user", "password")

@patch("mlx.coverity_services.requests")
@patch("mlx.coverity.coverity_services.requests")
def test_stream_validation(self, mock_requests):
"""Test if the function `validate_stream` is called once with the correct url"""
mock_requests.return_value = MagicMock(spec=requests)
Expand Down

0 comments on commit 85a6d8f

Please sign in to comment.