Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python code formatting #1

Open
emanuelbuholzer opened this issue Oct 15, 2024 · 0 comments
Open

Python code formatting #1

emanuelbuholzer opened this issue Oct 15, 2024 · 0 comments

Comments

@emanuelbuholzer
Copy link
Owner

Python code formatting was previously verified against flake8 and pep257 compatibility using unit tests.

test_pep257.py

from ament_pep257.main import main
import unittest


class TestPep257Compatibility(unittest.TestCase):
    def test_no_code_style_errors_and_warnings(self):
        rc = main(argv=[".", "test"])
        self.assertEqual(rc, 0, "Found code style errors / warnings")


if __name__ == "__main__":
    unittest.main()

test_flake8.py

from ament_flake8.main import main_with_errors
import unittest


class TestFlake8Compatibility(unittest.TestCase):
    def test_no_code_style_errors(self):
        rc, errors = main_with_errors(argv=[])
        self.assertEqual(
            rc,
            0,
            "Found %d code style errors / warnings:\n" % len(errors)
            + "\n".join(errors),
        )


if __name__ == "__main__":
    unittest.main()

These tests have been removed to separate testing from linting, as linting often occluded test results. Linting should still be verified in GitHub Actions and tooling around it should be provided. For example pre-commit hooks or tools for automatic reformatting.

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

No branches or pull requests

1 participant