
Research
wget to Wipeout: Malicious Go Modules Fetch Destructive Payload
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
π¬ A pytest plugin that transpiles Gherkin feature files to Python using AST, enforcing typing for ease of use and debugging.
This project allows you to write Gherkin-based behavior-driven development (BDD) tests and execute them using pytest.
It compiles Gherkin syntax into Python code using Abstract Syntax Tree (AST) manipulation, enabling seamless integration with pytest for running your tests.
Enjoy practicing BDD in modern Python (3.10+), type hinting, asyncio, dataclasses or Pydantic, pytest, playwright.
uv add --group dev tursu
The simplest way to initialize a test suite is to run the TurΕu cli.
uv run tursu init
πΏ uv run pytest --collect-only tests/functionals
========================== test session starts ==========================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
configfile: pyproject.toml
plugins: cov-6.0.0
collected 3 items
<Dir tursu>
<Package tests>
<Package funcs>
<GherkinDocument login.feature>
<Function test_7_Successful_sign_in_with_valid_credentials>
<Function test_10_Sign_in_fails_with_wrong_password>
<Function test_17_User_can_t_login_with_someone_else_username_16[Examples_16_0]>
<Function test_17_User_can_t_login_with_someone_else_username_16[Examples_16_1]>
====================== 3 tests collected in 0.01s =======================
πΏ uv run pytest tests/functionals
========================== test session starts ==========================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
configfile: pyproject.toml
collected 3 items
tests/functionals/test_login.py ... [ 33%]
.. [100%]
=========================== 3 passed in 0.02s ===========================
πΏ uv run pytest -v tests/functionals
============================= test session starts =============================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
configfile: pyproject.toml
collected 3 items
π Document: login.feature
π₯ Feature: User signs in with the right password
π¬ Scenario: Successful sign-in with valid credentials
β
Given a set of users:
β
When Bob signs in with password dumbsecret
β
Then the user is connected with username Bob
π Document: login.feature
π₯ Feature: User signs in with the right password
π¬ Scenario: Sign-in fails with wrong password
β
Given a set of users:
β
When Bob signs in with password notthat
β
Then the user is not connected
π Document: login.feature
π₯ Feature: User signs in with the right password
π¬ Scenario Outline: User can\'t login with someone else username
β
Given a set of users:
β
When Bob signs in with password anothersecret
β
Then the user is not connected
π Document: login.feature
π₯ Feature: User signs in with the right password
π¬ Scenario Outline: User can\'t login with someone else username
β
Given a set of users:
β
When Alice signs in with password dumbsecret
β
Then the user is not connected
PASSED
============================== 3 passed in 0.02s ==============================
πΏ uv run pytest -vv tests/functionals/login.feature
========================== test session starts ==========================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
configfile: pyproject.toml
plugins: cov-6.0.0, tursu-0.11.1
collected 3 items
tests/functionals/login.feature::test_3_User_can_login <- test_login.py
π Document: login.feature
π₯ Feature: User signs in with the right password
π¬ Scenario: Successful sign-in with valid credentials
β³ Given a user Bob with password dumbsecret
β
Given a user Bob with password dumbsecret
β³ When Bob signs in with password dumbsecret
β
When Bob signs in with password dumbsecret
β³ Then the user is connected with username Bob
β
Then the user is connected with username Bob
PASSED [ 33%]
tests/functionals/login.feature::test_7_User_can_t_login_with_wrong_password <- test_login.py
π Document: login.feature
π₯ Feature: User signs in with the right password
π¬ Scenario: Sign-in fails with wrong password
β³ Given a user Bob with password dumbsecret
β
Given a user Bob with password dumbsecret
β³ When Bob signs in with password notthat
β
When Bob signs in with password notthat
β³ Then the user is not connected
β
Then the user is not connected
PASSED [ 66%]
tests/functionals/login.feature::test_12_User_can_t_login_with_someone_else_username <- test_login.py
π Document: login.feature
π₯ Feature: User signs in with the right password
π¬ Scenario: User can\'t login with someone else username
β³ Given a user Bob with password bobsecret
β
Given a user Bob with password bobsecret
β³ Given a user Alice with password alicesecret
β
Given a user Alice with password alicesecret
β³ When Alice signs in with password bobsecret
β
When Alice signs in with password bobsecret
β³ Then the user is not connected
β
Then the user is not connected
PASSED [100%]
=========================== 3 passed in 0.02s ===========================
You can choose the test name ( tests/tests2/login.feature::test_3_User_can_login )
or even decorate with tag and use pytest markers (`pytest -m <tag>`).
πΏ uv run pytest tests/functionals
========================== test session starts ===========================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
rootdir: /home/guillaume/workspace/git/tursu
configfile: pyproject.toml
plugins: cov-6.0.0, tursu-0.12.4, playwright-0.7.0, base-url-2.1.0
collected 3 items
tests/functionals/login.feature F.. [100%]
================================ FAILURES ================================
_________________________ test_3_User_can_login __________________________
self = <tursu.runner.TursuRunner object at 0x76103daadbe0>, step = 'Then'
text = 'the user is connected with username Bobby'
kwargs = {'app': <tests.functionals.conftest.DummyApp object at 0x76103daad940>}
def run_step(
self,
step: StepKeyword,
text: str,
**kwargs: Any,
) -> None:
try:
> self.tursu.run_step(self, step, text, **kwargs)
src/tursu/runner.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/tursu/registry.py:102: in run_step
handler(**matches)
src/tursu/steps.py:38: in __call__
self.hook(**kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
app = <tests.functionals.conftest.DummyApp object at 0x76103daad940>
username = 'Bobby'
@then("the user is connected with username {username}")
def assert_connected(app: DummyApp, username: str):
> assert app.connected_user == username
E AssertionError
tests/functionals/steps.py:18: AssertionError
The above exception was the direct cause of the following exception:
request = <FixtureRequest for <Function test_3_User_can_login>>
capsys = <_pytest.capture.CaptureFixture object at 0x76103daae270>
tursu = <tursu.runtime.registry.Tursu object at 0x76103f107230>
app = <tests.functionals.conftest.DummyApp object at 0x76103daad940>
> ???
test_login.py:12:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tursu.runner.TursuRunner object at 0x76103daadbe0>, step = 'Then'
text = 'the user is connected with username Bobby'
kwargs = {'app': <tests.functionals.conftest.DummyApp object at 0x76103daad940>}
def run_step(
self,
step: StepKeyword,
text: str,
**kwargs: Any,
) -> None:
try:
self.tursu.run_step(self, step, text, **kwargs)
except Exception as exc:
> raise ScenarioFailed(self.fancy()) from exc
E tursu.runtime.runner.ScenarioFailed:
E ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
E β π Document: login.feature β
E β π₯ Feature: User signs in with the right password β
E β π¬ Scenario: Successful sign-in with valid credentials β
E β β
Given a set of users: β
E β β
When Bob signs in with password dumbsecret β
E β β Then the user is connected with username Bobby β
E ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
src/tursu/runner.py:81: ScenarioFailed
======================== short test summary info =========================
FAILED tests/functionals/login.feature::test_3_User_can_login - tursu.runner.ScenarioFailed:
If --trace is used, or -vvv, the tests files are written on the disk, and
the `???` in the context are replaced by the generated python test function.
This may be usefull in case of hard time debugging.
Combining TurΕu and pytest-playwright is a great experience. See the example in the documentation
TurΕu can also be combined with pytest-playwright-asyncio and run tests has coroutine using pytest-asyncio.
Scenario can be decorated with a @asyncio
tag. And they will run as a
coroutine marked with @pytest.mark.asyncio
.
And, the step definitions can be coroutine.
See the pytest-playwright-asyncio example in the documentation
See the example in the documentation
TurΕu use the gherkin-official package to parse Gherkin Scenario beeing compiled to python.
FAQs
π¬ A pytest plugin that transpiles Gherkin feature files to Python using AST, enforcing typing for ease of use and debugging.
We found that tursu demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.