Skip to content

Commit 6c5636b

Browse files
committed
ensure samples folder exists for microversion
When adding a microversion, a new corresponding folder for auto-generated samples is required. However, the folder has to be created manually for the generation to succeed. With this change, it is ensured that the folder is present, removing manual interaction. Closes-Bug: #1946771 Change-Id: I18f2e509f8c1ae3ad5866b568afc6e0c341e5c3e Signed-off-by: Jan Hartkopf <[email protected]>
1 parent fdfdba2 commit 6c5636b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nova/tests/functional/api_samples_test_base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ def _write_template(self, name, data):
135135
outf.write(data)
136136

137137
def _write_sample(self, name, data):
138-
with open(self._get_sample(
139-
name, self.microversion), 'w') as outf:
138+
sample_file = self._get_sample(name, self.microversion)
139+
140+
os.makedirs(os.path.dirname(sample_file), exist_ok = True)
141+
142+
with open(sample_file, 'w') as outf:
140143
outf.write(data)
141144

142145
def _compare_result(self, expected, result, result_str):

0 commit comments

Comments
 (0)