New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 1684 - Spawn not all switches work #1699
Conversation
First attempt** failed attempt ** Commit 1a6d7a2 attempts to satisfy That throws exception during
Commit 387a244 massages the tests so they pass again. Basically, I assert that diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py
index be47a06a..0007a84e 100644
--- a/evennia/commands/default/tests.py
+++ b/evennia/commands/default/tests.py
@@ -461,21 +461,21 @@ class TestBuilding(CommandTest):
self.call(building.CmdSpawn(), "/list", "Key ")
# @span/edit (missing prototype)
- self.call(
+ msg = self.call(
building.CmdSpawn(),
- '/edit',
- '@spawn: Extra switch "/edit" ignored.|Usage: @spawn <prototype-key> or {key: value, ...}\n (2 existing prototypes. Use /list to inspect)')
- # assert 'Prototype wizard' in msg
+ '/edit')
+ # '@spawn: Extra switch "/edit" ignored.|Usage: @spawn <prototype-key> or {key: value, ...}\n (2 existing prototypes. Use /list to inspect)')
+ assert 'Prototype wizard' in msg
# @spawn/edit with valid prototype
- # with self.assertRaises(AttributeError):
+ with self.assertRaises(AttributeError):
self.call(
building.CmdSpawn(),
'/edit BALL',
'@spawn: Extra switch "/edit" ignored.|Spawned Ball(#13).')
# @spawn/edit with invalid prototype
- #`with self.assertRaises(AttributeError):
+ with self.assertRaises(AttributeError):
self.call(
building.CmdSpawn(),
'/edit NO_EXISTS',
@@ -491,7 +491,8 @@ class TestBuilding(CommandTest):
self.call(
building.CmdSpawn(),
'/examine BALL',
- '@spawn: Extra switch "/examine" ignored.|Spawned Ball(#14).')
+ # '@spawn: Extra switch "/examine" ignored.|Spawned Ball(#14).')
+ '@spawn: Extra switch "/examine" ignored.|Spawned Ball(#13).')
# @spawn/examine with invalid prototype
self.call( I would guess that |
I think this issue boils down to requirements ... don't you think, @Griatch? What should the expected behavior be for the
|
It's incorrect to adjust the unit tests to assume exception raises, those are clearly bugs that need to be resolved and are due to changes in directory structure between 0.7 and 0.8.
At no point should an exception be rasied. |
Thank you @Griatch! Now that the expected behavior is clear, I'll try to fix these 2 switches as you depicted. |
Right, that was clear to me - sorry I wasn't explicit abut my approach. The point of me using At any rate, now that the requirements are clear, it should be straight forward to adapt the tests to the requirements and then 🤞 fix the bugs in |
@Griatch, I need a bit of help :( When testing Here is the ipdb session showing some of the steps and what some local variables contain. I stepped through until
Stepping over
After that, back in the test case, It resembles the olc menu but it's preceded by Does that output look correct?
I'm referring to commit 15c940f Specifically: |
…e '@spawn/edit testball' brings OLC menu. Handle '@spawn/edit NO_EXISTS' that returns error
@Henddher To check, I locally fixed the simple mis-call of The OLC header is admittedly not updated when a new prototype is loaded; it could be updated to show this by all means, as a usability improvement. |
I don't know how I could do that from the test-case :(
That's a good idea and if a header was added somewhere near the I'll see if I can patch Will keep you posted @Griatch! Thanks again! |
@Henddher It's pretty hacky to examine the text field of the olc header in the test suite anyway; better would be to analyze what prototype was loaded into the olc. You can do that like this (where if hasattr(caller.ndb._menutree, "olc_prototype"):
prototype = caller.ndb._menutree.olc_prototype If this |
Indeed ... but "ok" (I thought) as the majority of tests just validates string messages sent to the command caller (
Nice! will try that first and then modify the OCL title as a UX enhancement that can be asserted in the test Thanks! @Griatch |
Worked as a charm! 👍 👍 |
…u has been loaded with valid-prototype.UX Enhancement to OLC menu. Underneath the title, display 'Editing: key(prototype_key)' of the prototype being edited. If none, show blank line
@Griatch, I just realized another error:
The current implementation spawns a new object after warning that the switch
According to your clarification #1699 (comment), I will try to print the prototype instead. diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py
index 8dce5ccc..f285cc96 100644
@@ -518,6 +522,8 @@ class TestBuilding(CommandTest):
self.call(
building.CmdSpawn(),
'/examine BALL',
+ # FIXME: should this print the existing prototype
+ # instead of spawning it?
'@spawn: Extra switch "/examine" ignored.|Spawned Ball(#13).') I think that's the last the last outstanding issue originally reported by @kaleara |
Hi @Griatch With commit 79a64ce, I think this issue is ready for code review and hopefully merged. 🤞 Please note that I added one extra line to the OLC header as UX enhancement (9d800aa):
Don't know if there is a Wiki that should be updated as well? |
Looks good - thanks for the help! I don't think there is any wiki doc to update for this. |
Looks good - thanks for the help! I don't think there is any wiki doc to update for this. |
Evennia is lots of fun so it’s a pleasure to help out |
Closes #1684 |
Investigating #1684