From 842c17a32621c9c10063988958a5f8dea5642783 Mon Sep 17 00:00:00 2001 From: fliiiix Date: Sat, 23 Nov 2024 17:20:27 +0100 Subject: [PATCH] Change default marker to UUIDv4 --- CHANGELOG.md | 1 + docs/commandline.rst | 4 ++-- radish/main.py | 8 ++++---- tests/conftest.py | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb6c24f..20816b08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/docs/commandline.rst b/docs/commandline.rst index 1db65893..10cc784e 100644 --- a/docs/commandline.rst +++ b/docs/commandline.rst @@ -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: diff --git a/radish/main.py b/radish/main.py index f6caee0e..c12c546d 100644 --- a/radish/main.py +++ b/radish/main.py @@ -2,8 +2,8 @@ import os import sys +import uuid import warnings -from time import time from docopt import docopt import colorful @@ -66,8 +66,8 @@ def run_features(core): 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()) # scenario choice amount_of_scenarios = sum(len(f.scenarios) for f in core.features_to_run) @@ -123,7 +123,7 @@ def main(args=None): -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= specify the marker for this run [default: time.time()] + -m= --marker= specify the marker for this run [default: str(uuid.uuid4())] -b= --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 diff --git a/tests/conftest.py b/tests/conftest.py index 95a8a071..e17c7acb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,6 +10,7 @@ """ import os +import uuid import pytest @@ -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,