Skip to content

Commit

Permalink
#153 - Save point
Browse files Browse the repository at this point in the history
  • Loading branch information
antaenc committed Jan 28, 2025
1 parent 20ac03d commit c8fe051
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 29 deletions.
40 changes: 31 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

include makefiles/osdetect.mk

# Define newline for use
define \n

endef

# -----------------------------------------------------------------------------
# Variables
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -70,6 +75,12 @@ dependencies-for-development: venv dependencies-for-development-osarch-specific
python3 -m pip install --upgrade pip; \
python3 -m pip install --requirement development-requirements.txt

.PHONY: dependencies-for-documentation
dependencies-for-documentation: venv dependencies-for-documentation-osarch-specific
$(activate-venv); \
python3 -m pip install --upgrade pip; \
python3 -m pip install --requirement documentation-requirements.txt


.PHONY: dependencies
dependencies: venv
Expand Down Expand Up @@ -113,15 +124,15 @@ test-tests:
@$(activate-venv); pytest tests --verbose --capture=no --cov=src/senzing --cov-report xml:coverage.xml


.PHONY: test-examples
test-examples:
$(info --- Test examples --------------------------------------------------------------)
@$(activate-venv); python3 -m unittest \
examples/szconfig/*.py \
examples/szconfigmanager/*.py \
examples/szdiagnostic/*.py \
examples/szengine/*.py \
examples/szproduct/*.py
# .PHONY: test-examples
# test-examples:
# $(info --- Test examples --------------------------------------------------------------)
# @$(activate-venv); python3 -m unittest \
# examples/szconfig/*.py \
# examples/szconfigmanager/*.py \
# examples/szdiagnostic/*.py \
# examples/szengine/*.py \
# examples/szproduct/*.py


.PHONY: docker-test
Expand Down Expand Up @@ -187,63 +198,74 @@ print-make-variables:

.PHONY: bandit
bandit:
$(info ${\n})
$(info --- bandit ---------------------------------------------------------------------)
@$(activate-venv); bandit -c pyproject.toml $(shell git ls-files '*.py' ':!:docs/source/*')


.PHONY: black
black:
$(info ${\n})
$(info --- black ----------------------------------------------------------------------)
@$(activate-venv); black $(shell git ls-files '*.py' ':!:docs/source/*')


.PHONY: flake8
flake8:
$(info ${\n})
$(info --- flake8 ---------------------------------------------------------------------)
@$(activate-venv); flake8 $(shell git ls-files '*.py' ':!:docs/source/*')


.PHONY: isort
isort:
$(info ${\n})
$(info --- isort ----------------------------------------------------------------------)
@$(activate-venv); isort $(shell git ls-files '*.py' ':!:docs/source/*')


.PHONY: mypy
mypy:
$(info ${\n})
$(info --- mypy -----------------------------------------------------------------------)
@$(activate-venv); mypy --strict $(shell git ls-files '*.py' ':!:docs/source/*' ':!:examples/*')


.PHONY: pydoc
pydoc:
$(info ${\n})
$(info --- pydoc ----------------------------------------------------------------------)
@$(activate-venv); python3 -m pydoc


.PHONY: pydoc-web
pydoc-web:
$(info ${\n})
$(info --- pydoc-web ------------------------------------------------------------------)
@$(activate-venv); python3 -m pydoc -p 8885


.PHONY: pylint
pylint:
$(info ${\n})
$(info --- pylint ---------------------------------------------------------------------)
@$(activate-venv); pylint $(shell git ls-files '*.py' ':!:docs/source/*')


.PHONY: pytest
pytest:
$(info ${\n})
$(info --- pytest ---------------------------------------------------------------------)
@$(activate-venv); pytest $(shell git ls-files '*.py' ':!:docs/source/*')


.PHONY: sphinx
sphinx: sphinx-osarch-specific
$(info ${\n})
$(info --- sphinx ---------------------------------------------------------------------)


.PHONY: view-sphinx
view-sphinx: view-sphinx-osarch-specific
$(info ${\n})
$(info --- view-sphinx ----------------------------------------------------------------)
9 changes: 9 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ Since the Senzing library is a prerequisite, it must be installed first.

```

1. Install dependencies needed for documentation.
Example:

```console
cd ${GIT_REPOSITORY_DIR}
make dependencies-for-documentation

```

## Lint

1. Run linting.
Expand Down
9 changes: 9 additions & 0 deletions documentation-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
autodocsumm==0.2.14
myst_parser==4.0.0
senzing==0.2.1
sphinx-autodoc-typehints==3.0.0
sphinx-prompt==1.9.0
sphinxext-remoteliteralinclude==0.5.0
sphinx-rtd-theme==3.0.2
sphinx-toolbox==3.8.0
sphinx==8.1.3
24 changes: 9 additions & 15 deletions makefiles/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ coverage-osarch-specific:
.PHONY: dependencies-for-development-osarch-specific
dependencies-for-development-osarch-specific:

.PHONY: dependencies-for-documentation-osarch-specific
dependencies-for-documentation-osarch-specific:

.PHONY: documentation-osarch-specific
documentation-osarch-specific:
Expand Down Expand Up @@ -62,21 +64,13 @@ test-osarch-specific-2:
@pytest tests/ --verbose --capture=no --cov=src/senzing --cov-report xml:coverage.xml
# $(info --- Test examples ----------------------------------------------------)
# @pytest examples/ --verbose --capture=no --cov=src/senzing
$(info --- Test examples using unittest -------------------------------------)
@python3 -m unittest \
examples/szconfig/*.py \
examples/szconfigmanager/*.py \
examples/szdiagnostic/*.py \
examples/szengine/*.py \
examples/szproduct/*.py


.PHONY: test-examples-2
test-examples-2:
$(info --- Test examples using unittest -------------------------------------)
@python3 -m unittest \
examples/misc/add_truthset_datasources.py \
examples/misc/add_truthset_data.py
# $(info --- Test examples using unittest -------------------------------------)
# @python3 -m unittest \
# examples/szconfig/*.py \
# examples/szconfigmanager/*.py \
# examples/szdiagnostic/*.py \
# examples/szengine/*.py \
# examples/szproduct/*.py


.PHONY: venv-osarch-specific
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ warn_unused_ignores = "false"
[[tool.mypy.overrides]]
module = "examples.*"

[[tool.mypy.overrides]]
module = "pytest_schema.*"
ignore_missing_imports = "true"

[tool.pylint]
disable = [
"duplicate-code",
Expand Down
3 changes: 1 addition & 2 deletions src/senzing/szengineflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class SzEngineFlags(IntFlag):
def _members_dict(cls) -> Dict[str, int]:
return {member.name: member.value for member in cls if member.name and not member.name.startswith("_")}

# TODO Change tests and add these 2 new methods
@classmethod
def flags_by_name(cls: type[TSzEngineFlags]) -> Dict[str, int]:
"""
Expand Down Expand Up @@ -161,7 +160,7 @@ def flags_by_value(cls) -> Dict[int, str]:
# Flag for returning (or not) with info responses.

SZ_WITH_INFO = 1 << 62
__SZ_WITHOUT_INFO = 0 # __SZ_WITHOUT_INFO isn't in the C API, will be used for future methods.
_SZ_WITHOUT_INFO = 0 # __SZ_WITHOUT_INFO isn't in the C API, will be used for future methods.

# Flags for searching for entities.

Expand Down
11 changes: 8 additions & 3 deletions tests/szengineflags_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
TODO: szengineflags_test.py
"""

from pytest_schema import schema

from senzing import SzEngineFlags

Expand All @@ -16,13 +15,19 @@
def test_flags_by_name() -> None:
"""Test szengineflags.flags_by_name()."""
actual = SzEngineFlags.flags_by_name()
assert schema(test_flags_by_name_schema) == actual
# assert schema(test_flags_by_name_schema) == actual
assert isinstance(actual, dict)
for k, v in actual.items():
assert isinstance(k, str) and isinstance(v, int)


def test_flags_by_value() -> None:
"""Test szengineflags.flags_by_value()."""
actual = SzEngineFlags.flags_by_value()
assert schema(test_flags_by_value_schema) == actual
# assert schema(test_flags_by_value_schema) == actual
assert isinstance(actual, dict)
for k, v in actual.items():
assert isinstance(k, int) and isinstance(v, str)


# -----------------------------------------------------------------------------
Expand Down

0 comments on commit c8fe051

Please sign in to comment.