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 testing to the project #150

Open
glensc opened this issue Mar 22, 2021 · 11 comments
Open

Add testing to the project #150

glensc opened this issue Mar 22, 2021 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@glensc
Copy link
Collaborator

glensc commented Mar 22, 2021

With logic being isolated in newer PR's, it should make it possible to do unit and e2e testing.

Here's some related projects, which start PMS to use for testing:

@simonc56
Copy link
Collaborator

simonc56 commented Apr 5, 2021

Tests would be appreciated for sure.
Weeks ago,I started writing some for trakt_list_util (I'm newbie about unittests so personal use only).

@glensc
Copy link
Collaborator Author

glensc commented Apr 17, 2021

after reading this blog:

I decided to try pytest due it's simplicity writing tests and bundled with python.

Some tests are added, just to have the development aid of testing certain part of the code:

There's no structure there.

Ideally should have a common library that all tests can use. The object mocking should likely use something existing.

Anyway, to run the tests:

pytest path/to/test/file.py

# or 
python3 -m pytest path/to/test/file.py

@simonc56
Copy link
Collaborator

The tests I wrote for trakt_list_util are using mockdata from pytrakt project.
Do you think it's a good idea ?

@glensc
Copy link
Collaborator Author

glensc commented Apr 17, 2021

not sure what the mockdata is, could not find what loads those json from quick look. but pytrakt also seem to use pytest as rest runner.

@simonc56
Copy link
Collaborator

simonc56 commented Apr 17, 2021

It is fake data so we can test each and every function of our code without connecting to a real trakt/plex account.

@glensc
Copy link
Collaborator Author

glensc commented Apr 18, 2021

@twolaw I mean I don't know and on quick look did not understand how the files in mockdata used, so can't even say is it something they cooked on their own, or some library supports those files.

@simonc56
Copy link
Collaborator

simonc56 commented Apr 18, 2021

It is loaded with conftest.py as a Mock object to fake all trakt answers. Very smart.
We could do the same with Plex.

@glensc
Copy link
Collaborator Author

glensc commented Apr 18, 2021

Yes, found it, already using a similar approach:

@simonc56
Copy link
Collaborator

Yes it's good.
But PyTrakt project is Mocking the trakt.core instance which is much better because very close to reality.
I wonder if a copy/paste of all their test data is allowed.

@glensc glensc added the help wanted Extra attention is needed label Jun 20, 2021
@chrillep
Copy link
Contributor

chrillep commented Aug 7, 2021

ref Testing Click Applications

https://click.palletsprojects.com/en/8.0.x/testing/

@glensc
Copy link
Collaborator Author

glensc commented Aug 7, 2021

@chrillep thanks, but I don't think we should test e2e here, but rather unittest algorithms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants