huggingface / nanotron

Minimalistic large language model 3D-parallelism training
Apache License 2.0
1.14k stars 107 forks source link

Fix TestContext warning #156

Open AleHD opened 5 months ago

AleHD commented 5 months ago

When you run any test that uses TestContext you will get some warnings like this:

====================================================================== warnings summary ======================================================================
tests/helpers/context.py:7: 35 warnings                                        
  /mloscratch/homes/alhernan/project/workspace/nanotron/tests/helpers/context.py:7: PytestCollectionWarning: cannot collect test class 'TestContext' because i
t has a __init__ constructor (from: test_serialize.py)                         
    class TestContext:                                                         

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html                                                                                       
======================================================== 19 passed, 8 skipped, 35 warnings in 25.47s =========================================================

This can be easily fixed by setting __test__ = False in the TestContext class. This PR fixes those warnings.