Skip to content

tests: Start linting tests #1582

Description

@jku

I believe we should enable linting (tox -e lint) for new test files (maybe even for some recent additions). Possibly some exceptions are needed but in general I think the tests would be better if they were linted.

Good start for this would be test_updater_with_simulator.py and repository_simulator.py: it's new code and files are small so the changes are easy -- the real job is figuring out how to select what to lint... Possible options:

  • separate directory for legacy (unlinted) tests?
  • define list of linted files in tox.ini / setup.cfg ? (I don't like this one as it means default for new files is no lint)
  • define list of files excluded from lint in tox.ini & setup.cfg ?
  • some other strategy?

Activity

  1. joshuagl commented on Sep 15, 2021

    @joshuagl
    Member

    Splitting tests across multiple directories may make sense, but I think the right combination of simple and not prone to error is a list of files excluded from lint? That way, new test files are linted and there's no ambiguity about where to place new tests.

    Also, the no-lint list gets shorter as we replace/remove existing tests.

  2. jku commented on Sep 15, 2021

    @jku
    MemberAuthor

    I notice I did not explicitly state this: we currently have lint files/directories listed in multiple places in tox.ini and then in setup.cfg for static type checking with mypy

  3. added
    backlog
    on Sep 29, 2021
  4. added this to the Sprint 9 milestone on Sep 29, 2021
  5. MVrachev commented on Oct 8, 2021

    @MVrachev
    Collaborator

    I think I will experiment by renaming all old test files with <name>_old.py and experiment with exclusion rules.

  6. sechkova commented on Oct 8, 2021

    @sechkova
    Contributor

    I think I will experiment by renaming all old test files with <name>_old.py and experiment with exclusion rules.

    Can we use a prefix instead of a suffix so the files appear sorted in a way?

  7. MVrachev commented on Oct 8, 2021

    @MVrachev
    Collaborator

    I think I will experiment by renaming all old test files with <name>_old.py and experiment with exclusion rules.

    Can we use a prefix instead of a suffix so the files appear sorted in a way?

    I thought about adding a suffix instead of a prefix as the filenames will be easier to read.
    Although as they are test files for the old legacy code maybe we want to see them grouped and that will make the other files more visible.
    Do the others have an opinion?

  8. jku commented on Oct 11, 2021

    @jku
    MemberAuthor

    I expect prefixes would make more sense, if files need to be mass-renamed

  9. MVrachev commented on Oct 11, 2021

    @MVrachev
    Collaborator

    Another reasonable solution seems to move the old files in a separate folder, but if we move them won't we lose the git history?

  10. MVrachev commented on Oct 11, 2021

    @MVrachev
    Collaborator

    I read the GIT FAQ on this matter https://git.wiki.kernel.org/index.php/GitFaq#Why_does_Git_not_.22track.22_renames.3F and found out that both renames and file relocations will cause the git history to be lost.
    That's why I researched for another option that won't change the titles or move the test files.
    I think I have some progress with isort and black, but they require to hardcode each of the test files we are going to exclude. This makes sense when we consider they don't have a distinguished regex we can exclude.
    Even though it's a big list of around 30 files, I think this solution is fine as this list will only contain files testing the old code meaning the list will have a static content.

  11. modified the milestones: Sprint 9, Sprint 10 on Oct 13, 2021
  12. modified the milestones: Sprint 10, Sprint 11 on Oct 27, 2021
  13. MVrachev commented on Nov 2, 2021

    @MVrachev
    Collaborator

    I will remove this issue from Sprint 11 for now as it contains multiple action items each of which requires a review.

  14. removed this from the Sprint 11 milestone on Nov 2, 2021
  15. MVrachev commented on Nov 9, 2021

    @MVrachev
    Collaborator

    TODO items left to close this issue:

  16. added this to the Sprint 12 milestone on Nov 10, 2021
  17. modified the milestones: Sprint 12, Sprint 13 on Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backlogtesting

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions