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

Change default marker to UUIDv4 #476

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changes
- Drop Python 3.6 and Python 3.7
- Drop the `--profile` option, please use `--user-data`
- Change default marker from unix timestamp to UUIDv4

## [v0.17.1]

Expand Down
4 changes: 2 additions & 2 deletions docs/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ Run - Use custom marker to uniquely identify test run
-----------------------------------------------------

Radish supports marker functionality which is used to uniquely identify a
specific test run. By default the marker is set to the number of seconds from
the epoch (01/01/1970). You can specify your own marker using the ``-m`` or
specific test run. By default the marker is set to a random UUID Version 4.
You can specify your own marker using the ``-m`` or
``--marker`` command line option.

The marker is also displayed in the summary of a test run:
Expand Down
8 changes: 4 additions & 4 deletions radish/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import os
import sys
import uuid
import warnings
from time import time

from docopt import docopt
import colorful
Expand Down Expand Up @@ -66,8 +66,8 @@
merge_steps(core.features, StepRegistry().steps)

# run parsed features
if world.config.marker == "time.time()":
world.config.marker = int(time())
if world.config.marker == "str(uuid.uuid4())":
world.config.marker = str(uuid.uuid4())

Check warning on line 70 in radish/main.py

View check run for this annotation

Codecov / codecov/patch

radish/main.py#L70

Added line #L70 was not covered by tests

# scenario choice
amount_of_scenarios = sum(len(f.scenarios) for f in core.features_to_run)
Expand Down Expand Up @@ -123,7 +123,7 @@
-e --early-exit stop the run after the first failed step
--debug-steps debugs each step
-t --with-traceback show the Exception traceback when a step fails
-m=<marker> --marker=<marker> specify the marker for this run [default: time.time()]
-m=<marker> --marker=<marker> specify the marker for this run [default: str(uuid.uuid4())]
-b=<basedir> --basedir=<basedir>... set base dir from where the step.py and terrain.py will be loaded. [default: $PWD/radish]
You can specify -b|--basedir multiple times or split multiple paths with a colon (:) similar to $PATH. All files will be imported.
-d --dry-run make dry run for the given feature files
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import os
import uuid

import pytest

Expand Down Expand Up @@ -55,7 +56,7 @@ def mock_world_config():
"--inspect-after-failure": False,
"--junit-xml": None,
"--junit-relaxed": False,
"--marker": "time.time()",
"--marker": "str(uuid.uuid4())",
"--no-ansi": False,
"--no-line-jump": False,
"--scenarios": None,
Expand Down