Skip to content

Commit

Permalink
Merge pull request #77 from questionlp/develop
Browse files Browse the repository at this point in the history
Replace NamedTuple Cursors with Dictionary Cursors, Code Cleanup, Add Test Code Coverage
  • Loading branch information
questionlp authored Oct 5, 2024
2 parents 2740e3e + 6e600e2 commit c694c28
Show file tree
Hide file tree
Showing 46 changed files with 667 additions and 672 deletions.
45 changes: 38 additions & 7 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,47 @@
Changes
*******

2.12.0
======

Application Changes
-------------------

* Replace all references of ``named_tuple=`` in database cursors to ``dictionary=`` due to cursors using ``NamedTuple`` being marked for deprecation in future versions of MySQL Connector/Python
* Update code that is impacted by the database cursor type change from ``NamedTuple`` to ``dict``
* Additional code cleanup

Compoennt Changes
-----------------

* Upgrade mysql-connector-python from 8.2.0 to 8.4.0
* Upgrade numpy from 1.26.4 to 2.1.0
* Upgrade python-slugify from 8.0.1 to 8.0.4
* Upgrade pytz from 2024.1 to 2024.2

Development Changes
-------------------

* Upgrade black from 24.4.2 to 24.8.0
* Upgrade pytest from 8.1.2 to 8.3.3
* Upgrade ruff from 0.6.7 to 0.6.9
* Add initial pytest coverage reporting using ``pytest-cov``, which can be generated by running: ``pytest --cov=wwdtm tests/``.

Document Changes
----------------

* Sync required package versions with main package requirements

2.11.0
======

Application Changes
-------------------

* Fix issues or add exceptions to Pylint errors and warnings
* Remove an errant semicolon in ``wwdtm.location.location.retrieve_all``
* Replace "Wait Wait Don't Tell Me! Stats" with "Wait Wait Stats" in docstrings

Development Changes
-------------------

Expand All @@ -16,13 +54,6 @@ Development Changes
* Upgrade ruff from 0.3.6 to 0.6.7
* Upgrade wheel from 0.43.0 to 0.44.0

Application Changes
-------------------

* Fix issues or add exceptions to Pylint errors and warnings
* Remove an errant semicolon in ``wwdtm.location.location.retrieve_all``
* Replace "Wait Wait Don't Tell Me! Stats" with "Wait Wait Stats" in docstrings

Documentation Changes
---------------------

Expand Down
12 changes: 6 additions & 6 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pytest==8.1.2
black==24.4.2
pytest==8.3.3
black==24.8.0

mysql-connector-python==8.2.0
numpy==1.26.4
python-slugify==8.0.1
pytz==2024.1
mysql-connector-python==8.4.0
numpy==2.1.0
python-slugify==8.0.4
pytz==2024.2

Sphinx==8.0.2
sphinx-autobuild==2024.9.19
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ classifiers = [
]

dependencies = [
"mysql-connector-python==8.2.0",
"numpy==1.26.4",
"python-slugify==8.0.1",
"pytz==2024.1",
"mysql-connector-python==8.4.0",
"numpy==2.1.0",
"python-slugify==8.0.4",
"pytz==2024.2",
]

[project.urls]
Expand All @@ -41,7 +41,7 @@ requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
required-version = "24.4.2"
required-version = "24.8.0"
target-version = ["py310", "py311", "py312"]
line-length = 88

Expand Down
15 changes: 8 additions & 7 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ruff==0.6.7
black==24.4.2
pytest==8.1.2
ruff==0.6.9
black==24.8.0
pytest==8.3.3
pytest-cov==5.0.0
wheel==0.44.0
build==1.2.2

mysql-connector-python==8.2.0
numpy==1.26.4
python-slugify==8.0.1
pytz==2024.1
mysql-connector-python==8.4.0
numpy==2.1.0
python-slugify==8.0.4
pytz==2024.2
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mysql-connector-python==8.2.0
numpy==1.26.4
python-slugify==8.0.1
pytz==2024.1
mysql-connector-python==8.4.0
numpy==2.1.0
python-slugify==8.0.4
pytz==2024.2
2 changes: 0 additions & 2 deletions tests/guest/test_guest_appearances.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("guest_id", [976])
def test_guest_appearances_retrieve_appearances_by_id(guest_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/guest/test_guest_guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


def test_guest_retrieve_all():
"""Testing for :py:meth:`wwdtm.guest.Guest.retrieve_all`."""
Expand Down
2 changes: 0 additions & 2 deletions tests/guest/test_guest_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("guest_id", [54])
def test_guest_utility_convert_id_to_slug(guest_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/host/test_host_appearances.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("host_id", [2])
def test_host_appearances_retrieve_appearances_by_id(host_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/host/test_host_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


def test_host_retrieve_all():
"""Testing for :py:meth:`wwdtm.host.Host.retrieve_all`."""
Expand Down
2 changes: 0 additions & 2 deletions tests/host/test_host_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("host_id", [2])
def test_host_utility_convert_id_to_slug(host_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/location/test_location_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


def test_location_retrieve_all():
"""Testing for :py:meth:`wwdtm.location.Location.retrieve_all`."""
Expand Down
2 changes: 0 additions & 2 deletions tests/location/test_location_recordings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("location_id", [95])
def test_location_recordings_retrieve_recordings_by_id(location_id: int):
Expand Down
32 changes: 17 additions & 15 deletions tests/location/test_location_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("location_id", [95])
def test_location_utility_convert_id_to_slug(location_id: int):
Expand Down Expand Up @@ -133,31 +131,33 @@ def test_location_utility_slug_not_exists(location_slug: str):

@pytest.mark.parametrize("city", ["Chicago"])
def test_location_utility_slugify_location_city(city: str):
"""Negative testing for :py:meth:`wwdtm.location.LocationUtility.slugify_location` with city name.
"""Negative testing for :py:meth:`wwdtm.location.LocationUtility.slugify_location`.
Testing with city name.
:param city: City to include in the slug string
"""
with pytest.raises(ValueError):
utility = LocationUtility(connect_dict=get_connect_dict())
slug = utility.slugify_location(city=city)
utility = LocationUtility(connect_dict=get_connect_dict())
with pytest.raises(ValueError) as exception_info:
_ = utility.slugify_location(city=city)

assert slug, "Unable to convert into a slug string"
assert isinstance(slug, str), "Value returned is not a string"
assert str(exception_info.value) == "Invalid location information provided"


@pytest.mark.parametrize("city, state", [("Chicago", "IL")])
def test_location_utility_slugify_location_city_state(city: str, state: str):
"""Negative testing for :py:meth:`wwdtm.location.LocationUtility.slugify_location` with city and state names.
"""Negative testing for :py:meth:`wwdtm.location.LocationUtility.slugify_location`.
Testing with city and state names.
:param city: City to include in the slug string
:param state: State to include in the slug string
"""
with pytest.raises(ValueError):
utility = LocationUtility(connect_dict=get_connect_dict())
slug = utility.slugify_location(city=city, state=state)
utility = LocationUtility(connect_dict=get_connect_dict())
with pytest.raises(ValueError) as exception_info:
_ = utility.slugify_location(city=city, state=state)

assert slug, "Unable to convert into a slug string"
assert isinstance(slug, str), "Value returned is not a string"
assert str(exception_info.value) == "Invalid location information provided"


@pytest.mark.parametrize(
Expand All @@ -166,7 +166,9 @@ def test_location_utility_slugify_location_city_state(city: str, state: str):
def test_location_utility_slugify_location_full(
location_id: int, venue: str, city: str, state: str
):
"""Testing for :py:meth:`wwdtm.location.LocationUtility.slugify_location` with location ID, venue, city and state names.
"""Testing for :py:meth:`wwdtm.location.LocationUtility.slugify_location`.
Testing with location ID, venue, city and state names.
:param location_id: Location ID to include in the slug string
:param venue: Venue name to include in the slug string
Expand Down
2 changes: 0 additions & 2 deletions tests/panelist/test_panelist_appearances.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize(
"panelist_id, use_decimal_scores",
Expand Down
2 changes: 0 additions & 2 deletions tests/panelist/test_panelist_decimal_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("panelist_id", [14])
def test_panelist_scores_retrieve_scores_by_id(panelist_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/panelist/test_panelist_panelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


def test_panelist_retrieve_all():
"""Testing for :py:meth:`wwdtm.panelist.Panelist.retrieve_all`."""
Expand Down
2 changes: 0 additions & 2 deletions tests/panelist/test_panelist_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("panelist_id", [14])
def test_panelist_scores_retrieve_scores_by_id(panelist_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/panelist/test_panelist_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("panelist_id", [14])
def test_panelist_statistics_retrieve_bluffs_by_id(panelist_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/panelist/test_panelist_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("panelist_id", [14])
def test_panelist_utility_convert_id_to_slug(panelist_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/pronoun/test_pronoun_pronouns.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


def test_pronouns_retrieve_all():
"""Testing for :py:meth:`wwdtm.pronoun.Pronouns.retrieve_all`."""
Expand Down
2 changes: 0 additions & 2 deletions tests/scorekeeper/test_scorekeeper_appearances.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("scorekeeper_id", [13])
def test_scorekeeper_appearance_retrieve_appearances_by_id(scorekeeper_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/scorekeeper/test_scorekeeper_scorekeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


def test_scorekeeper_retrieve_all():
"""Testing for :py:meth:`wwdtm.scorekeeper.Scorekeeper.retrieve_all`."""
Expand Down
2 changes: 0 additions & 2 deletions tests/scorekeeper/test_scorekeeper_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("scorekeeper_id", [2])
def test_scorekeeper_utility_convert_id_to_slug(scorekeeper_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/show/test_show_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("show_id", [319, 1162])
def test_show_info_retrieve_bluff_info_by_id(show_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/show/test_show_info_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("show_id", [319, 1083, 1162])
def test_show_info_retrieve_bluff_info_all(show_id: int):
Expand Down
2 changes: 0 additions & 2 deletions tests/show/test_show_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


def test_show_retrieve_all():
"""Testing for :py:meth:`wwdtm.show.Show.retrieve_all`."""
Expand Down
2 changes: 0 additions & 2 deletions tests/show/test_show_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def get_connect_dict() -> dict[str, Any]:
if "database" in config_dict:
return config_dict["database"]

return None


@pytest.mark.parametrize("year, month, day", [(2018, 10, 27)])
def test_show_utility_convert_date_to_id(year: int, month: int, day: int):
Expand Down
Loading

0 comments on commit c694c28

Please sign in to comment.