File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import json
5
5
import os
6
+ from pathlib import Path
6
7
from subprocess import Popen
7
8
import warnings
8
9
@@ -97,7 +98,7 @@ def __init__(
97
98
98
99
self .consumer = consumer
99
100
self .file_write_mode = file_write_mode
100
- self .pact_dir = pact_dir or os .getcwd ()
101
+ self .pact_dir = Path ( pact_dir or os .getcwd ()). resolve ()
101
102
self .provider = provider
102
103
self .publish_to_broker = publish_to_broker
103
104
self .version = version
@@ -176,11 +177,16 @@ def write_to_pact_file(self):
176
177
177
178
:rtype: int
178
179
"""
180
+ if not self .pact_dir .exists ():
181
+ self .pact_dir .mkdir (parents = True )
182
+ elif not self .pact_dir .is_dir ():
183
+ raise NotADirectoryError (f"{ self .pact_dir } is not a directory" )
184
+
179
185
command = [
180
186
MESSAGE_PATH ,
181
187
"update" ,
182
188
json .dumps (self ._messages [0 ]),
183
- "--pact-dir" , self .pact_dir ,
189
+ "--pact-dir" , str ( self .pact_dir ) ,
184
190
f"--pact-specification-version={ self .version } " ,
185
191
"--consumer" , f"{ self .consumer .name } " ,
186
192
"--provider" , f"{ self .provider .name } " ,
You can’t perform that action at this time.
0 commit comments