Skip to content
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

Drop system tests with lettuce #280

Closed
eoan-ermine opened this issue Mar 8, 2023 · 6 comments · Fixed by #296
Closed

Drop system tests with lettuce #280

eoan-ermine opened this issue Mar 8, 2023 · 6 comments · Fixed by #296

Comments

@eoan-ermine
Copy link
Contributor

lettuce has not been updated for a very long time, and the latest version it supports is python 2.7, which is incompatible with python 3.6 or python 3.7 from our requirements

Just an attempt to execute ./run_lettuce gives an error:

  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/lettuce/__init__.py", line 179
    print "Error loading step definitions:\n", e
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
@eoan-ermine eoan-ermine changed the title Drop lettuce support Drop system tests with lettuce Mar 8, 2023
@eoan-ermine
Copy link
Contributor Author

@eoan-ermine
Copy link
Contributor Author

aloe is an alternative, but there's one issue. It doesn't supports something like lettuce.django.mail, so we need to think how to rewrite (or remove) this one step:

@step('The administrators should get an email about a new question')
def the_administrators_should_get_an_email_about_a_new_question(step):
    for admin in settings.ADMINS:
        message = mail.queue.get(True, timeout=5)
        assert admin[1] in message.recipients()
        assert 'Someone made a question' in message.subject

@eoan-ermine
Copy link
Contributor Author

There is also troubles with lettuce fork that pretends to support python 3:

(venv) eoanermine@eoanermine:~/cppquiz$ ./run_lettuce 
/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/fuzzywuzzy/fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
  warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
Traceback (most recent call last):
  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/lettuce/django/server.py", line 63, in <module>
    from django.utils.six.moves import socketserver
ModuleNotFoundError: No module named 'django.utils.six'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/eoanermine/cppquiz/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 279, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 48, in load_command_class
    module = import_module("%s.management.commands.%s" % (app_name, name))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/lettuce/django/management/commands/harvest.py", line 34, in <module>
    from lettuce.django.server import LettuceServerException
  File "/home/eoanermine/cppquiz/venv/lib/python3.10/site-packages/lettuce/django/server.py", line 65, in <module>
    import SocketServer as socketserver
ModuleNotFoundError: No module named 'SocketServer'

@knatten
Copy link
Owner

knatten commented Mar 9, 2023

Yeah these have not been maintained since at least 2016. It's mentioned in the README, but nice to get an issue for it too. I haven't worked in web development since 2007 or so, so I have no idea what's good these days! :D

I would also be fine with skipping the BDD style tests entirely and just convert the tests in quiz/features to regular python system tests with splinter. Maybe that's actually better anyway, since it will be more familiar to regular Python devs, and there's little value to the BDD style anyway when everyone involved is a programmer.

@tocic
Copy link
Contributor

tocic commented Mar 10, 2023

There is also an alternative called behave which seems to be well-maintained.

Differences from lettuce.
Integration with Django.

@knatten
Copy link
Owner

knatten commented Mar 10, 2023

Personally I would prefer to just convert them to regular python tests, I don't think we need a BDD-framework. The reason I went BDD back then was just as an excuse to try a BDD framework for the first time.

But if anyone is keen on trying out behave or aloe or something, I'm fine with that too. The only requirement from my side is that it's well maintained, and doesn't put any unnecessary limitations on what we're able to test.

tocic added a commit to tocic/cppquiz that referenced this issue Mar 23, 2023
* Feature -> TestCase
* Scenario -> TestCase's method prefixed with "test_"
* Step -> TestCase's method not prefixed with "test_"
* terrain.py and steps.py -> SystemTestCase's methods
* python asserts -> django asserts
* lettuce mail -> django mail

Closes knatten#280.

Signed-off-by: tocic <tocic@protonmail.ch>
tocic added a commit to tocic/cppquiz that referenced this issue Mar 23, 2023
* Feature -> TestCase
* Scenario -> TestCase's method prefixed with "test_"
* Step -> TestCase's method not prefixed with "test_"
* terrain.py and steps.py -> SystemTestCase's methods
* python asserts -> django asserts
* lettuce mail -> django mail

Closes knatten#280.

Signed-off-by: tocic <tocic@protonmail.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants