Skip to content

Commit

Permalink
Check were all the deprecation runtime error is raised
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Jan 2, 2024
1 parent b09aa17 commit ae4cf54
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/pytests/unit/modules/test_aptpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,6 @@ def test_list_repos():
assert repos[source_uri][0]["uri"][-1] == "/"


@pytest.mark.filterwarnings("RuntimeError")
def test__expand_repo_def():
"""
Checks results from _expand_repo_def
Expand Down Expand Up @@ -1270,30 +1269,31 @@ def test_expand_repo_def_cdrom():

# Valid source
repo = "# deb cdrom:[Debian GNU/Linux 11.4.0 _Bullseye_ - Official amd64 NETINST 20220709-10:31]/ bullseye main\n"
sanitized = aptpkg.expand_repo_def(os_name="debian", repo=repo, file=source_file)
log.warning("SAN: %s", sanitized)
with pytest.raises(RuntimeError):
sanitized = aptpkg.expand_repo_def(os_name="debian", repo=repo, file=source_file)
log.warning("SAN: %s", sanitized)

assert isinstance(sanitized, dict)
assert "uri" in sanitized
assert isinstance(sanitized, dict)
assert "uri" in sanitized

# Make sure last character in of the URI is still a /
assert sanitized["uri"][-1] == "/"
# Make sure last character in of the URI is still a /
assert sanitized["uri"][-1] == "/"

# Pass the architecture and make sure it is added the the line attribute
repo = "deb http://cdn-aws.deb.debian.org/debian/ stretch main\n"
sanitized = aptpkg.expand_repo_def(
os_name="debian", repo=repo, file=source_file, architectures="amd64"
)
# Pass the architecture and make sure it is added the the line attribute
repo = "deb http://cdn-aws.deb.debian.org/debian/ stretch main\n"
sanitized = aptpkg.expand_repo_def(
os_name="debian", repo=repo, file=source_file, architectures="amd64"
)

# Make sure line is in the dict
assert isinstance(sanitized, dict)
assert "line" in sanitized
# Make sure line is in the dict
assert isinstance(sanitized, dict)
assert "line" in sanitized

# Make sure the architecture is in line
assert (
sanitized["line"]
== "deb [arch=amd64] http://cdn-aws.deb.debian.org/debian/ stretch main"
)
# Make sure the architecture is in line
assert (
sanitized["line"]
== "deb [arch=amd64] http://cdn-aws.deb.debian.org/debian/ stretch main"
)


def test__expand_repo_def_not_repo():
Expand Down

0 comments on commit ae4cf54

Please sign in to comment.