-
Notifications
You must be signed in to change notification settings - Fork 4
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
[WIP] Gherkin feature suite #32
Draft
domi41
wants to merge
60
commits into
MieuxVoter:master
Choose a base branch
from
domi41:feat-gherkin
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note from an old-timer: Adding `.env` to the tree is not common, and may yield security risks. What is usually done is to git ignore `.env` and provide a `.env.dist`.
This is usually considered a good practice (except in javascript -_-), since it's versioning friendly and line-duplication friendly.
BREAKING CHANGE: old syntax won't work anymore
BREAKING CHANGE: `LANGUAGE_AVAILABLE` -> `LANGUAGES_AVAILABLE`
Let's experiment with `behave-django`. The directory `features/fr` ought to be a git submodule. We now need consent from everyone about the first scenario before we can proceed. Keep in mind that we need to write one scenario at a time, then implement it, and then write another. We must not write many scenarios at once. It's going to be tempting. Don't do it. https://www.lesswrong.com/posts/uHYYA32CKgKT3FagE/hold-off-on-proposing-solutions This should be considered like a Constitution, where each article is thoroughly debated and carefully worded. There will be some technical constraints in Gherkin that Constitutions don't have.
This is a meta feature about the steps in the features. This way I can work on stuff without deciding on the scenarios.
Note how naive parse_amount() is for now. … We cheated.
"Requérir la présence à priori de scrutins." Another brick in setting up the contexts we'll want for our scenarios. Language detection is a dummy for now. But we're add a rather fault-intolerant but working YAML perser to use with step pystrings. I18N support is overall made of tape (not even cardboard).
domi41
commented
Apr 27, 2020
Eval is Evil. – Your friend, _The Sign Painter_
Tested: - raw assert (not explicit) - describe (stale) - compare (stale) - nose-tools (very few tools, no?) Not tested - behave-pytest (404, did not inquire further) - etc. Looks like full I18N support is not coming out of the box. https://github.com/oboff/hamcrest/issues/80 Inquiring further…
Our language pool is the one of `text2num`. (at least en, fr, es) Gherkin itself is widely translated and extendable in behave IIRC. This commit introduces a huge list of `ISO 639-1` codes. Esperanto is often overlooked in centralized databases.
Esoteric steps run from the inside and access the database directly. Exoteric steps run from the outside and run REST requests.
Note: Shared context variables are tempting but ought to be scarce and carefully though of, since they often incur inertia and creep.
This may eventually support email and id.
Behave is tricky to configure in order to show the output. This step does not yield very useful information for now, but it allows us to debug and experiment with behave conf.
Actors provide a handy layer over requests. Especially useful once authentication kicks in. Right now they are empty and hacky, but the idea is there.
I know, it's buried behind `/api/elections` for now. A good idea is to prefix the API by `/v1`.
Just experimenting this pattern, to see if step defs get prettier. … And what's the cost.
Make sure when using print() in step defs to end it with a `\n`, This is a pitfall of behave, I guess? We can set the format to plain, using the --format plain CLI option, since the `format = plain` in the `.behaverc` changes nothing. When in plain format, there are no colors and our print() appears. We tried behave 1.2.6 and 1.2.7-dev2. This may well be solved by some tweaking. Found out about `aloe`, and `pytest-bdd`. This may well be solved by some experimenting.
Printing is not as good in behave as it is in other runners, at least from an end-user perspective.
We hacked (very) partial I18N support in hamcrest. Still need to figure out if we're going to use `gettext` or `python-i18n`, or even something else.
Perhaps behave already does this behind the scenes. It does not affect the output of the built-in AssertionError.
Eating a chartreuse cookie.
We also introduce a step to pass the time.
We'll move them into a submodule or a subtree?
Perhaps we should move to subtree? Not sure.
… I don't understand why this bug has been alive for years. The Formatter interface is well-thought, thankfully.
SonarCloud Quality Gate failed. 22 Bugs No Coverage information |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Gherkin features ! #29
python manage.py behave
What I've got so far.
Esoteric (direct access to database)
Exoteric (via REST)
Step: register userTooling
that_poll
I18N of Assertion Lib(see Sketch an implementation of I18N. hamcrest/PyHamcrest#144)This PR is definitely NOT atomic. Sorry about that. There's no way around it, the first PR is going to be big and will introduce breaking changes. I broke one thing, and once that anvil dropped…