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

Add basic unit tests for pipelines.py #5

Open
ejseqera opened this issue Jun 12, 2023 · 2 comments
Open

Add basic unit tests for pipelines.py #5

ejseqera opened this issue Jun 12, 2023 · 2 comments
Assignees
Labels
tests Add or fix unit/integration tests

Comments

@ejseqera
Copy link
Owner

Will serve as a starting point for additional unit tests for other classes, and run with CI/CD

  • Can use the monkeypatch fixture to make the tests simpler
@ejseqera ejseqera added the tests Add or fix unit/integration tests label Jun 12, 2023
@ejseqera ejseqera self-assigned this Jun 12, 2023
@ejseqera
Copy link
Owner Author

ejseqera commented Jun 12, 2023

I've started implementing tests on the linked development branch.

Starting with pipelines.py, my intention is to test in the following way:

  1. Mocking tests (in tests/unit):
  • Mock the _tw_run method through isolation of methods in Pipelines() (i.e. Pipelines.add(), and Pipelines.get_list()) and making sure these correctly call the _tw_run method with correct arguments (this is the lowest level of isolation for testing)
  • Mock subprocess to make sure methods in Pipelines() work when arguments are passed to _tw_run and a shell command string is correctly called/constructed (do the commands match with how you would run it on the CLI?)
  1. Integration tests (in tests/integration):
  • Test methods through actual execution of the subprocess commands in a suitable environment
  • For example, on scidev/testing or scidev/showcase, include a test that will actually run Pipelines.get_list("scidev/testing")
  • Here, we can make assertions about the JSON outputs and etc
  • Long term, this should include a workspace like scidev/showcase that is reliably maintained but how do we set up an access token to use in a different environment (i.e. CI/CD)?
  • These don't have to be immediate because if we have tests that mock subprocess we have assurance we're constructing the correct CLI commands as mentioned above

@ejseqera
Copy link
Owner Author

Need to update these based on the new implementation of the wrapper.

@ejseqera ejseqera added wontfix This will not be worked on and removed wontfix This will not be worked on labels Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Add or fix unit/integration tests
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant