4
31
Fork
You've already forked simplematrixbotlib
21

Tests are failing on 0.2.12 #90

Closed
opened 2024年07月28日 09:31:42 +02:00 by lambda · 5 comments
Contributor
Copy link

Describe the bug
Several tests in the test suite are failing on release 0.2.12.

To Reproduce

$ PYTHONPATH=. pytest
===================================== test session starts =====================================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
rootdir: /tmp/simplematrixbotlib
configfile: pyproject.toml
plugins: typeguard-4.3.0, anyio-4.4.0
collected 18 items
tests/api/test_api.py . [ 5%]
tests/config/test_config.py ..F. [ 27%]
tests/listener/test_listener.py .... [ 50%]
tests/match/test_match.py .... [ 72%]
tests/match/test_messagematch.py .FFFF [100%]
========================================== FAILURES ===========================================
_______________________________________ test_write_toml _______________________________________
 def test_write_toml():
 tmp_file = os.path.join(sample_config_path, 'config_tmp.toml')
 config = botlib.Config()
 # write all defined values
 config.save_toml(tmp_file)
 default_values = (
 "[simplematrixbotlib.config]\n"
 "timeout = 65536\n"
 "join_on_invite = true\n"
 f"encryption_enabled = {'true' if ENCRYPTION_ENABLED else 'false'}\n"
 "emoji_verify = false\n"
 "ignore_unverified_devices = true\n"
 "store_path = \"./store/\"\n"
 "allowlist = []\n"
 "blocklist = []\n")
 assert os.path.isfile(tmp_file)
 with open(tmp_file, 'r') as f:
> assert f.read() == default_values
E AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n'
E
E Skipping 190 identical leading characters in diff, use -v to show
E klist = []
E + first_sync_full = false
tests/config/test_config.py:116: AssertionError
________________________________________ test_command _________________________________________
 def test_command():
> assert match.command() == "help"
E AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> == 'help'
E + where <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> = command()
E + where command = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.command
tests/match/test_messagematch.py:29: AssertionError
_________________________________________ test_prefix _________________________________________
 def test_prefix():
> assert match.prefix() == True
E AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> == True
E + where <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> = prefix()
E + where prefix = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.prefix
tests/match/test_messagematch.py:41: AssertionError
__________________________________________ test_args __________________________________________
 def test_args():
> assert match.args() == ["example"]
E AssertionError: assert <MagicMock na...348498766624'> == ['example']
E
E Use -v to get more diff
tests/match/test_messagematch.py:48: AssertionError
________________________________________ test_contains ________________________________________
 def test_contains():
> assert match.contains("!h") == True
E AssertionError: assert False == True
E + where False = contains('!h')
E + where contains = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.contains
tests/match/test_messagematch.py:54: AssertionError
=================================== short test summary info ===================================
FAILED tests/config/test_config.py::test_write_toml - AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n'
FAILED tests/match/test_messagematch.py::test_command - AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getite...
FAILED tests/match/test_messagematch.py::test_prefix - AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816...
FAILED tests/match/test_messagematch.py::test_args - AssertionError: assert <MagicMock na...348498766624'> == ['example']
FAILED tests/match/test_messagematch.py::test_contains - AssertionError: assert False == True
================================ 5 failed, 13 passed in 1.62s =================================

Expected behavior
Test pass.

Desktop (please complete the following information):

  • OS: Arch Linux
  • Python Version: 3.12.4
  • Package Version: 0.2.12
**Describe the bug** Several tests in the test suite are failing on release 0.2.12. **To Reproduce** ``` $ PYTHONPATH=. pytest ===================================== test session starts ===================================== platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0 rootdir: /tmp/simplematrixbotlib configfile: pyproject.toml plugins: typeguard-4.3.0, anyio-4.4.0 collected 18 items tests/api/test_api.py . [ 5%] tests/config/test_config.py ..F. [ 27%] tests/listener/test_listener.py .... [ 50%] tests/match/test_match.py .... [ 72%] tests/match/test_messagematch.py .FFFF [100%] ========================================== FAILURES =========================================== _______________________________________ test_write_toml _______________________________________ def test_write_toml(): tmp_file = os.path.join(sample_config_path, 'config_tmp.toml') config = botlib.Config() # write all defined values config.save_toml(tmp_file) default_values = ( "[simplematrixbotlib.config]\n" "timeout = 65536\n" "join_on_invite = true\n" f"encryption_enabled = {'true' if ENCRYPTION_ENABLED else 'false'}\n" "emoji_verify = false\n" "ignore_unverified_devices = true\n" "store_path = \"./store/\"\n" "allowlist = []\n" "blocklist = []\n") assert os.path.isfile(tmp_file) with open(tmp_file, 'r') as f: > assert f.read() == default_values E AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n' E E Skipping 190 identical leading characters in diff, use -v to show E klist = [] E + first_sync_full = false tests/config/test_config.py:116: AssertionError ________________________________________ test_command _________________________________________ def test_command(): > assert match.command() == "help" E AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> == 'help' E + where <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> = command() E + where command = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.command tests/match/test_messagematch.py:29: AssertionError _________________________________________ test_prefix _________________________________________ def test_prefix(): > assert match.prefix() == True E AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> == True E + where <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> = prefix() E + where prefix = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.prefix tests/match/test_messagematch.py:41: AssertionError __________________________________________ test_args __________________________________________ def test_args(): > assert match.args() == ["example"] E AssertionError: assert <MagicMock na...348498766624'> == ['example'] E E Use -v to get more diff tests/match/test_messagematch.py:48: AssertionError ________________________________________ test_contains ________________________________________ def test_contains(): > assert match.contains("!h") == True E AssertionError: assert False == True E + where False = contains('!h') E + where contains = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.contains tests/match/test_messagematch.py:54: AssertionError =================================== short test summary info =================================== FAILED tests/config/test_config.py::test_write_toml - AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n' FAILED tests/match/test_messagematch.py::test_command - AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getite... FAILED tests/match/test_messagematch.py::test_prefix - AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816... FAILED tests/match/test_messagematch.py::test_args - AssertionError: assert <MagicMock na...348498766624'> == ['example'] FAILED tests/match/test_messagematch.py::test_contains - AssertionError: assert False == True ================================ 5 failed, 13 passed in 1.62s ================================= ``` **Expected behavior** Test pass. **Desktop (please complete the following information):** - OS: Arch Linux - Python Version: 3.12.4 - Package Version: 0.2.12
Contributor
Copy link

@DavidCruciani Please take a look.

@DavidCruciani Please take a look.
Contributor
Copy link

Looks like at least PR #88 forgot to update tests and there is also no CI running them

Looks like at least PR #88 forgot to update tests and there is also no CI running them
Owner
Copy link

Looks like at least PR #88 forgot to update tests and there is also no CI running them

Indeed, I'll update the tests to fix this.

> Looks like at least PR #88 forgot to update tests and there is also no CI running them Indeed, I'll update the tests to fix this.
Owner
Copy link

@lambda Please try again

@lambda Please try again
Author
Contributor
Copy link

Yep, fd20c3e7ec fixes it, thanks!

Yep, fd20c3e7eca6e349d3378c05bc76ed5ff1f41795 fixes it, thanks!
Sign in to join this conversation.
No Branch/Tag specified
master
v3
send_reaction
v2.13.1
v2.13.0
v2.12.2
v2.12.1
v2.12.0
v2.11.0
v2.10.3
v2.10.2
v2.10.1
v2.10.0
v2.9.1
v2.9.0
v2.7.4
v2.7.3
v2.7.2
v2.7.0
v2.6.4
v2.6.3
v2.6.2
v2.6.1
v2.6.0
v1.6.0
v2.5.1
v2.5.0
v2.4.1
v2.4.0
v2.3.0
v2.2.0
v2.1.0
v2.0.0
v1.6.1
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.0
v1.3.3
v1.3.1
v1.3.0
v1.2.0
v1.3.2
v1.0.1
v1.0.0
v1.1.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
imbev/simplematrixbotlib#90
Reference in a new issue
imbev/simplematrixbotlib
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?