ramonsaraiva / django-expiry

Expiry rules for Django sessions
MIT License
22 stars 6 forks source link

Adding poetry and Django test structure #5

Closed rjauquet closed 6 years ago

rjauquet commented 6 years ago

Added some ideas for test infrastructure. Open to other suggestions!

After installing poetry:

poetry install
poetry run ./manage.py test

The test isn't really checking anything important but I wanted to make sure all the importing logic and calling worked.

ramonsaraiva commented 6 years ago

That's pretty cool. I'm not really familar with poetry, could you explain me what are those dependencies in that lock file?

rjauquet commented 6 years ago

Yeah! Poetry is a dependency manager, and the lock file just guarantees each person setting up the code gets exactly the same dependency list on the same version on python. It's not strictly necessary but it can save some headaches for sure.

ramonsaraiva commented 6 years ago

Yup! I get that, but, I see there are a few dependencies already defined in the file, besides Django. Are those dependencies of Django itself? Or they were added mistakenly?

rjauquet commented 6 years ago

Sorry, I misunderstood. Yes. Absolutely we don't need Pytest. I removed it now. The lock should just be sub-dependencies of Django

AhmedRedaAmin commented 6 years ago

hey @rjauquet can you help me out with something ? selection_066 I can't understand why it is failing here ? The virtualenv is part of poetry's setup AFAIK .

rjauquet commented 6 years ago

Yes, the poetry setup should create the virtualenv. I just tried this locally and was able to get it working. I'm wondering if poetry was installed with an incompatible version of python. Could you try sourcing into the virtualenv directly and then running ./manage.py test?

source /root/.cache/pypoetry/virtualenvs/django-expiry-py3.6/bin/activate
./manage.py test

I think is your path. How did you install poetry?

AhmedRedaAmin commented 6 years ago

@rjauquet , no worries , I managed to resolve it , seems when you use sudo , it instantiates the virtualenv in a different location than it normally does .