Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

function names should be more meaningful #52

Open
kimberlythegeek opened this issue Oct 26, 2018 · 1 comment
Open

function names should be more meaningful #52

kimberlythegeek opened this issue Oct 26, 2018 · 1 comment

Comments

@kimberlythegeek
Copy link
Contributor

kimberlythegeek commented Oct 26, 2018

I will file a similar issue for axe-selenium-python. Its execute method should be renamed to run, because it is executing axe.run(), and does so without any modification in behavior

run in pytest-axe should be renamed to something like run_and_return_violations

def run(self):
"""Inject aXe, run against current page, and return rules & violations."""
self.inject()
data = self.execute(self.context, self.options)
violations = dict(
(rule["id"], rule)
for rule in data["violations"]
if self.impact_included(rule)
)

analyze should be renamed to run_tests_and_write_violations_to_file or something similar

def analyze(self):
"""Run aXe accessibility checks, and write results to file."""
violations = self.run()
# Format file name based on page title and current datetime.
t = time.strftime("%m_%d_%Y_%H:%M:%S")
title = self.selenium.title
title = re.sub("[\s\W]", "-", title)
title = re.sub("(-|_)+", "-", title)
# Output results only if reporting is enabled.
if environ.get("ACCESSIBILITY_REPORTING") == "true":
# Write JSON results to file if recording enabled
self.write_results("%s_%s.json" % (title, t), violations)
assert len(violations) == 0, self.report(violations)

@kimberlythegeek
Copy link
Contributor Author

kimberlythegeek commented Oct 30, 2018

the execute method in axe-selenium-python has been updated to run, any calls to this method in pytest-axe need to be updated as well.

data = self.execute(self.context, self.options)

I believe this may be the only one ^

https://github.com/mozilla-services/axe-selenium-python/pull/162/files#diff-bbb980400907694c70c13691cf468553R32

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant