@@ -44,19 +44,17 @@ def run_p4d(p4port, from_zip=None):
4444 archive .extractall (tmpdir )
4545
4646 p4ssldir = os .path .join (tmpdir , 'ssl' )
47- p4trust = os .path .join (tmpdir , 'trust.txt' )
4847 shutil .copytree (os .path .join (os .path .dirname (__file__ ), 'fixture' , 'insecure-ssl' ), p4ssldir )
4948 # Like a beautifully crafted work of art, p4d fails to start if permissions on the secrets are too open.
5049 # https://www.perforce.com/manuals/v18.1/cmdref/Content/CmdRef/P4SSLDIR.html
5150 os .chmod (p4ssldir , 0o700 )
5251 os .chmod (os .path .join (p4ssldir , 'privatekey.txt' ), 0o600 )
5352 os .chmod (os .path .join (p4ssldir , 'certificate.txt' ), 0o600 )
5453 os .environ ['P4SSLDIR' ] = p4ssldir
55- os .environ ['P4TRUST' ] = p4trust
5654
5755 yield subprocess .Popen (['p4d' , '-r' , tmpdir , '-p' , p4port ])
5856
59- @pytest .fixture
57+ @pytest .fixture ( scope = 'package' )
6058def server ():
6159 """Start a p4 server in the background and return the address"""
6260 port = find_free_port ()
@@ -414,18 +412,24 @@ def test_stream_switching_migration(server, tmpdir):
414412
415413def test_fingerprint_good (server , tmpdir ):
416414 """Test supplying the correct fingerprint"""
415+ os .environ ['P4TRUST' ] = os .path .join (tmpdir , 'trust.txt' )
416+
417417 repo = P4Repo (root = tmpdir , fingerprint = __LEGIT_P4_FINGERPRINT__ )
418418 synced = repo .sync ()
419419 assert len (synced ) > 0 , "Didn't sync any files"
420420
421421def test_fingerprint_bad (server , tmpdir ):
422422 """Test supplying an incorrect fingerprint"""
423+ os .environ ['P4TRUST' ] = os .path .join (tmpdir , 'trust.txt' )
424+
423425 repo = P4Repo (root = tmpdir , fingerprint = 'FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF' )
424426 with pytest .raises (Exception , match = r"The authenticity of '.+' can't be established" ):
425427 repo .sync ()
426428
427429def test_fingerprint_changed (server , tmpdir ):
428430 """Test updating a fingerprint"""
431+ os .environ ['P4TRUST' ] = os .path .join (tmpdir , 'trust.txt' )
432+
429433 repo = P4Repo (root = tmpdir , fingerprint = 'FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF' )
430434 with pytest .raises (Exception , match = r"The authenticity of '.*' can't be established" ):
431435 repo .sync ()
0 commit comments