3
3
import subprocess
4
4
import unittest
5
5
import argparse
6
- from tempfile import TemporaryDirectory
7
- from pathlib import Path
8
6
import os
9
7
import re
10
8
import fnmatch
11
9
import json
12
- from . import TEST_DIR , STDB_DIR , STDB_CONFIG , build_template_target
10
+ from . import TEST_DIR , build_template_target
13
11
import smoketests
14
12
import logging
15
13
@@ -23,6 +21,16 @@ def check_docker():
23
21
print ("Docker container not found, is SpacetimeDB running?" )
24
22
exit (1 )
25
23
24
+ def check_dotnet () -> bool :
25
+ try :
26
+ version = smoketests .run_cmd ("dotnet" , "--version" , log = False ).strip ()
27
+ if int (version .split ("." )[0 ]) < 8 :
28
+ logging .info (f"dotnet version { version } not high enough (< 8.0), skipping dotnet smoketests" )
29
+ return False
30
+ except Exception :
31
+ return False
32
+ return True
33
+
26
34
class ExclusionaryTestLoader (unittest .TestLoader ):
27
35
def __init__ (self , excludelist = ()):
28
36
super ().__init__ ()
@@ -49,6 +57,7 @@ def main():
49
57
parser = argparse .ArgumentParser ()
50
58
parser .add_argument ("test" , nargs = "*" , default = tests )
51
59
parser .add_argument ("--docker" , action = "store_true" )
60
+ parser .add_argument ("--skip-dotnet" , action = "store_true" , help = "ignore tests which require dotnet" )
52
61
parser .add_argument ("--show-all-output" , action = "store_true" , help = "show all stdout/stderr from the tests as they're running" )
53
62
parser .add_argument ("--parallel" , action = "store_true" , help = "run test classes in parallel" )
54
63
parser .add_argument ("-j" , dest = 'jobs' , help = "Set number of jobs for parallel test runs. Default is `nproc`" , type = int , default = 0 )
@@ -71,6 +80,12 @@ def main():
71
80
subprocess .Popen (["docker" , "logs" , "-f" , docker_container ])
72
81
smoketests .HAVE_DOCKER = True
73
82
83
+ if not args .skip_dotnet :
84
+ smoketests .HAVE_DOTNET = check_dotnet ()
85
+ if not smoketests .HAVE_DOTNET :
86
+ print ("no suitable dotnet installation found" )
87
+ exit (1 )
88
+
74
89
add_prefix = lambda testlist : [TESTPREFIX + test for test in testlist ]
75
90
import fnmatch
76
91
excludelist = add_prefix (args .exclude )
0 commit comments