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

Python 3 support for testing #220

Closed
niharikasingh opened this issue Nov 10, 2019 · 6 comments
Closed

Python 3 support for testing #220

niharikasingh opened this issue Nov 10, 2019 · 6 comments

Comments

@niharikasingh
Copy link
Contributor

Behavior driven testing currently relies on Lettuce. However, Lettuce doesn't seem to work on Python 3, based on my difficulties using it and this issue:

Aloe seems to be a good replacement for Python 3 users. I was able to get Aloe up and running with only the following minor changes. Would it be possible to make these changes and mention them in the documentation?

docassemble.py

  1. tests/features/steps/docassemble.py renamed to tests/features/__init.py__
  2. from lettuce import step, world changed to from aloe import step, world
  3. All the steps changed to use regexes instead of strings. So: @step('I spend at least ([0-9]+) seconds? on each page') changed to @step(r'I spend at least ([0-9]+) seconds? on each page')

terrain.py

  1. All lettuce imports replaced with from aloe import *
  2. The tear_down() function didn't work out of the box. I made it work by removing functionality, but it might be possible to work while retaining all the original functionality, it would just require some investigation. My current working function looks like:
def tear_down():
    world.browser.quit()

Documentation

  1. The documentation will need to be updated to account for the above changes.

Please let me know if you have any questions about the above. I'm happy to help implement the above changes if the maintainers agree they are warranted.

@jhpyle
Copy link
Owner

jhpyle commented Nov 16, 2019

Thanks! I made these changes in 0.5.38. Let me know if you find any problems with it.

@niharikasingh
Copy link
Contributor Author

Just one comment - I had to move the location of docassemble.py to get this to work in my repo. It went from tests/features/steps/docassemble.py to tests/features/__init.py__. If you've tested that your way works too, then that's fine!

@jhpyle
Copy link
Owner

jhpyle commented Nov 21, 2019

Did you try creating empty __init__.py files in tests/features and tests/features/steps? That was what worked for me.

@jhpyle
Copy link
Owner

jhpyle commented Nov 23, 2019

I am keeping this issue open because maybe it makes sense to transition to pytest-bdd instead of aloe? I don't know; I haven't tried pytest-bdd yet but it seems to be recommended.

@niharikasingh
Copy link
Contributor Author

Did you try creating empty __init__.py files in tests/features and tests/features/steps? That was what worked for me.

I didn't try that! If it works, that's great. I'll try it next time I work on my docassemble project.

@jhpyle
Copy link
Owner

jhpyle commented Jan 5, 2020

I migrated all testing to Aloe and it seems to work, so I am closing this issue. Thanks!

@jhpyle jhpyle closed this as completed Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants