Skip to content

Commit 5f53883

Browse files
Hacky fix for parameter expansion
When executing Pynguin in Docker on the cluster I had trouble with the new space-separated parameters for the output_variables property. This is now a quick hack around to also use a comma-separated list for this property, which will be expanded automatically when constructing the Configuration object. This is bad, I know, but it is a quick hack around the issue to be able to run things on the cluster.
1 parent a99a3a7 commit 5f53883

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pynguin/generator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def __init__(
101101
if configuration:
102102
config.INSTANCE = configuration
103103
elif argument_parser and arguments:
104+
arguments = self._expand_arguments_if_necessary(arguments)
104105
parsed = argument_parser.parse_args(arguments)
105106
config.INSTANCE = parsed.config
106107
verbosity = parsed.verbosity
@@ -110,6 +111,17 @@ def __init__(
110111
)
111112
self._logger = self._setup_logging(verbosity, config.INSTANCE.log_file)
112113

114+
@staticmethod
115+
def _expand_arguments_if_necessary(arguments: List[str]) -> List[str]:
116+
if "--output_variables" not in arguments:
117+
return arguments
118+
index = arguments.index("--output_variables")
119+
if "," not in arguments[index + 1]:
120+
return arguments
121+
variables = arguments[index + 1].split(",")
122+
output = arguments[: index + 1] + variables + arguments[index + 2 :]
123+
return output
124+
113125
def run(self) -> int:
114126
"""Run the test generation.
115127

0 commit comments

Comments
 (0)