How to run Luigi unittests?

80 views
Skip to first unread message

Tashrif B.

unread,
Dec 11, 2020, 6:05:58 PM12/11/20
to Luigi
Hi,

I am trying to contribute to Luigi but failing to run unit tests:

cd luigi/test
python -m unittest discover -p cmdline_test.py

Then I get a bunch of errors like:

 FileNotFoundError: [Errno 2] No such file or directory: './bin/luigi': './bin/luigi'

I tried modifying PATH and PYTHONPATH in different ways but didn't help.

So what is the recommended way of doing this?

Thanks,
Tashrif 

Dillon Stadther

unread,
Dec 12, 2020, 8:54:11 AM12/12/20
to Luigi
Hey Tashrif,

The luigi project uses tox for running tests. Take a look at https://github.com/spotify/luigi/blob/master/CONTRIBUTING.rst for running large sections of tests. Also take a look at tox documentation for targetting a specific file or test function.

--
Dillon

Tashrif B.

unread,
Dec 13, 2020, 1:21:10 AM12/13/20
to Luigi
Hi Dillon,

Thanks for your suggestion. I tried following that but haven't succeeded much:
 
(base) [tb571@~ luigi]$ tox -e py36-core test/cmdline_test.py
 
py36-core create: ~/Downloads/luigi/.tox/py36-core
py36-core installdeps: mock<2.0, moto==1.3.6, HTTPretty==0.8.10, nose<2.0, docker>=2.1.0, unittest2<2.0, boto<3.0, boto3>=1.4.4, pyhive[presto]==0.6.1, s3transfer==0.1.13, sqlalchemy<2.0, elasticsearch<2.0.0, psutil<4.0, enum34>1.1.0, mysql-connector-python>=8.0.12, avro-python3, google-compute-engine, coverage>=4.1,<4.2, codecov>=1.4.0, requests>=2.20.0,<3.0, pygments, hypothesis[datetime]<4.0.0, selenium==3.0.2, pymongo==3.4.0, toml<2.0.0, responses<1.0.0, azure-storage<=0.36, datadog==0.22.0, prometheus-client==0.5.0



For a long time, nothing happens. Then, upon Ctrl+C: 

^CERROR: got KeyboardInterrupt signal
_____________________________________________________ summary ______________________________________________________
  py36-core: commands succeeded
  congratulations :)


I understand that Travis-CI would run the tests when I submit a PR but it would be good to be able to run them locally before submitting one.

Best,
Tashrif

--
You received this message because you are subscribed to the Google Groups "Luigi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to luigi-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/luigi-user/698eb663-2f63-432a-8bdf-941252347cc9n%40googlegroups.com.

pete

unread,
Dec 13, 2020, 3:02:54 PM12/13/20
to Tashrif B., Luigi
Tashrif
Sorry for not being more responsive. You're doing thorough work here and you deserve some better support from folks like myself. It's been a few years since I've run the full spectrum of luigi tests but it is my experience the tests take a long time to run, especially within a pristine python environment.

How long would you say it waits, and, do you see any significant cpu activity during this time in the python process, and, are there any INI files where you can enable debug logging?

Finally, while it's always GOOD to run these tests, given the goal of your change I anticipate the impact/risk is low enough where travis can run it for you and a code review would suffice. I just dont want to see this detail be a hangup for you thats all.



--
Reply all
Reply to author
Forward
0 new messages