Skip to content

Commit e85ea45

Browse files
terrameijarKimberly Sereduck
authored andcommitted
Fix for #155 (#157)
* Allows write_results to take a path * fixed pep8 issues * Fixed default arguments and updated path handling logic
1 parent df3300d commit e85ea45

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

axe_selenium_python/axe.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,19 @@ def report(self, violations):
9393
string += "\n\n\n"
9494
return string
9595

96-
def write_results(self, data, name="results.json"):
96+
def write_results(self, data, name=None):
9797
"""
9898
Write JSON to file with the specified name.
9999
100-
:param name: Name of file to be written to.
100+
:param name: Path to the file to be written to. If no path is passed
101+
a new file will be created.
101102
:param output: JSON object.
102103
"""
103-
filepath = os.path.join(os.getcwd(), name)
104+
105+
if name:
106+
filepath = os.path.abspath(name)
107+
else:
108+
filepath = os.path.join(os.path.getcwd(), name)
104109

105110
with open(filepath, "w", encoding="utf8") as f:
106111
try:

0 commit comments

Comments
 (0)