Skip to main content

What's New in Vedro v1.12

· 4 min read

We are excited to announce the release of Vedro v1.12, bringing several new features and enhancements designed to improve your testing experience. Let's dive into the details of this update.

New Assertions with Beautiful Diffs

Enhanced AssertionError Output

We've introduced new assertions that provide beautiful and informative diffs, making it easier to spot differences between expected and actual values.

AssertionError
>>> assert actual == expected
{
- 'task_id': 1,
+ 'task_id': 2,
'description': 'Implement user authentication system',
...
'assignee': 'Bob',
- 'due_date': '2024-07-14'
+ 'due_date': '2024-07-15'
}


# --seed 69a72e09-1556-4cd7-b13a-895797bd2cd0
# 1 scenario, 0 passed, 1 failed, 0 skipped (0.10s)

Full Diff Display

For more detailed output, use the --show-full-diff argument to see the complete diff of the assertions.

$ vedro run --show-full-diff
AssertionError
>>> assert actual == expected
{
'total': 1,
'items': [
{
- 'task_id': 1,
+ 'task_id': 2,
'description': 'Implement user authentication system',
'status': 'in progress',
'assignee': 'Bob',
- 'due_date': '2024-07-14'
+ 'due_date': '2024-07-15'
}
]
}


# --seed afa8aad3-0a43-44f1-b12c-cbfa9c57ee63
# 1 scenario, 0 passed, 1 failed, 0 skipped (0.10s)
note

If you prefer the old behavior, you can use the --legacy-assertions argument.

New Command-Line Arguments

Change Project Directory

The --project-dir argument allows you to specify the root directory of your project, providing a reference point for relative paths and file operations. By default, it uses the directory from which the command is executed.

$ vedro run --project-dir /app/tests

Enhancements to RichReporter

Suppress Modules in Traceback

The tb_suppress_modules parameter allows you to suppress specific modules in the traceback output, making the relevant information more prominent.

# vedro.cfg.py
class RichReporter(vedro.plugins.director.rich.RichReporter):
tb_suppress_modules = [json]
Scenarios
*
✗ login as user
✔ given_user_creds
✔ when_user_logins
✔ then_it_should_return_ok_status
✗ and_it_should_return_json_body
╭───────────────────── Traceback (most recent call last) ───────────────────╮
/tests/scenarios/login_as_user.py:33 in and_it_should_return_json_body

30 assert self.response.status_code == 200
31
32 def and_it_should_return_json_body(self):
33 assert json.loads(self.response.body) == {}
34
╰───────────────────────────────────────────────────────────────────────────╯
JSONDecodeError: Expecting value: line 1 column 2 (char 1)


# --seed 19686856-8704-4d7b-8088-6044ba4e8052
# 1 scenario, 0 passed, 1 failed, 0 skipped (0.10s)

Traceback Width Control

Set the width of the traceback output with the tb_width parameter. If not set, the terminal width will be used. The default value is tb_width = 100.

# vedro.cfg.py
class RichReporter(vedro.plugins.director.rich.RichReporter):
tb_width = 120

Show Scope

The show_scope parameter (and --show-scope or -S argument) provides a snapshot of crucial variables when a test scenario fails. It is now the recommended way to show scope.

$ vedro run -S

tip

For the latest news and updates, subscribe to our Telegram or Twitter