[SERVER-29836] Running unit test test_evergreen.py requires PYTHONPATH Created: 23/Jun/17  Updated: 29/Mar/18  Resolved: 29/Mar/18

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Robert Guo (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-29644 Add support for resmoke.py to run Pyt... Closed
Operating System: ALL
Sprint: TIG 2018-04-09
Participants:

 Description   

The unit test buildscripts/tests/ciconfig/test_evergreen.py requires setting PYTHONPATH if it's invoked as

python buildscripts/tests/ciconfig/test_evergreen.py
Traceback (most recent call last):
  File "buildscripts/tests/ciconfig/test_evergreen.py", line 9, in <module>
    import buildscripts.ciconfig.evergreen as _evergreen
ImportError: No module named buildscripts.ciconfig.evergreen

This works:

PYTHONPATH=. python buildscripts/tests/ciconfig/test_evergreen.py
................
----------------------------------------------------------------------
Ran 16 tests in 0.048s
 
OK



 Comments   
Comment by Robert Guo (Inactive) [ 29/Mar/18 ]

Closing as a dupe of SERVER-29644

Comment by Max Hirschhorn [ 27/Jun/17 ]

We should remove the if __name__ == "__main__" logic from each of the unit tests. We can use either python -m discover ... to run the test cases from a particular directory or implement SERVER-29644 and use resmoke.py to run them.

Comment by Yves Duhem [ 23/Jun/17 ]

It is possible to run the tests from the root of the repository using:

python -m unittest buildscripts.tests.ciconfig.test_evergreen

I propose removing the option to run the test_evergreen module as a script or leaving it as is (requiring the path to contain the root of the repository).
The alternative is to modify the path dynamically, which I would prefer to avoid.

Generated at Thu Feb 08 04:21:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.