Skip to content

Commit

Permalink
tests: Modify tests to allow random order running
Browse files Browse the repository at this point in the history
You can achieve this now by installing pytest-random-order:

pip3 install pytest-random-order

Then running pytest with this:

python3 -m pytest --random-order=package -nauto --dist=loadfile

Tests will be run in a random order.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Jul 31, 2024
1 parent 3b3fff4 commit 5379770
Show file tree
Hide file tree
Showing 406 changed files with 1,672 additions and 404 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import glob
from time import sleep

pytestmark = [
pytestmark = [pytest.mark.random_order(disabled=True),
pytest.mark.babeld,
pytest.mark.bgpd,
pytest.mark.isisd,
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/babel_topo1/test_babel_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import json
from functools import partial

pytestmark = [pytest.mark.babeld]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.babeld]

# Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bgpd, pytest.mark.bfdd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.bfdd]


def setup_module(mod):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_isis_topo1/test_bfd_isis_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bfdd, pytest.mark.isisd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.isisd]


def setup_module(mod):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_ospf_topo1/test_bfd_ospf_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bfdd, pytest.mark.ospfd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.ospfd]


def setup_module(mod):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd, pytest.mark.isisd, pytest.mark.ospfd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd, pytest.mark.isisd, pytest.mark.ospfd]


def setup_module(mod):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_topo1/test_bfd_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd]


def setup_module(mod):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_topo2/test_bfd_topo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd, pytest.mark.ospfd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd, pytest.mark.ospfd]


def setup_module(mod):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_topo3/test_bfd_topo3.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd]


def setup_module(mod):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# Required to instantiate the topology builder class.

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# Required to instantiate the topology builder class.

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from lib.topolog import logger
from lib.checkping import check_ping

pytestmark = [pytest.mark.bgpd, pytest.mark.isisd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.isisd]


def build_topo(tgen):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_accept_own/test_bgp_accept_own.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from lib import topotest
from lib.topogen import Topogen, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]

CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_aigp/test_bgp_aigp.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from lib.bgp import verify_bgp_convergence, verify_bgp_rib, create_router_bgp, clear_bgp
from lib.topojson import build_config_from_json

pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.staticd]

# Reading the data from JSON File for topology creation
topo = None
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
)
from lib.topojson import build_config_from_json

pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.staticd]

# Global variables
BGP_CONVERGENCE = False
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_as_override/test_bgp_as_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_asdot_regex/test_bgp_asdot_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from functools import partial

# add after imports, before defining classes or functions:
pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]

CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_aspath_zero/test_bgp_aspath_zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_auth/test_bgp_auth1.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
)
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd, pytest.mark.ospfd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.ospfd]

CWD = os.path.dirname(os.path.realpath(__file__))

Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_auth/test_bgp_auth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
)
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd, pytest.mark.ospfd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.ospfd]

CWD = os.path.dirname(os.path.realpath(__file__))

Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_auth/test_bgp_auth3.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
)
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd, pytest.mark.ospfd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.ospfd]

CWD = os.path.dirname(os.path.realpath(__file__))

Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_auth/test_bgp_auth4.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
)
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd, pytest.mark.ospfd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.ospfd]

CWD = os.path.dirname(os.path.realpath(__file__))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
from lib.topojson import build_config_from_json
from lib.topolog import logger

pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.staticd]


# Global Variable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import kill_router_daemons, step

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import kill_router_daemons, step

pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bfdd, pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/bgp_bmp/test_bgp_bmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]

# remember the last sequence number of the logging messages
SEQ = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.common_config import step

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from lib.topojson import build_config_from_json
from copy import deepcopy

pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.staticd]


# Global variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
)
from lib.topojson import build_config_from_json

pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd, pytest.mark.staticd]


# Global variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from lib.common_config import step
from time import sleep

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]


def build_topo(tgen):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import pytest
import functools

pytestmark = [pytest.mark.bgpd]
pytestmark = [pytest.mark.random_order(disabled=True), pytest.mark.bgpd]

CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
Expand Down
Loading

0 comments on commit 5379770

Please sign in to comment.