linkedin / detext

DeText: A Deep Neural Text Understanding Framework for Ranking and Classification Tasks
BSD 2-Clause "Simplified" License
1.26k stars 133 forks source link

Add missing __init__.py to test modules #37

Closed StarWang closed 4 years ago

StarWang commented 4 years ago

Description

34 reports an issue that pytest could not correctly locate the test packages. A literature search on pytest issues shows that it could be due to the missing __init__.py in the test folder pytest#3789.

Currently the detext test folder misses __init__.py in some of the folders. It is in the following structure

test/
|-- <missing __init__.py>
|-- test_run_detext.py
|-- model/
     |-- __init__.py
     |-- test_xxx.py
|-- train/
     |-- __init__.py
     |-- test_xxx.py
|-- utils/
     |-- <missing __init__.py>
     |-- test_xxx.py

This could result in a mess during test package importing pytest import mechanism

Fixes # (issue)

34

Type of change

List all changes

Add __init__.py in folder test and test/utils

Checklist

StarWang commented 4 years ago

Thanks. But I cannot reproduce the error in #34. Pytest always works for me. Is it cause by the missing of the init files?

@xwli-chelsea I didn't try to reproduce the error as it works for me as well. I suspect that the failure to error reproduction is because our python and pytest version is different from the reporter.

Since partially missing __init__.py was reported in pytest issues before, I made this patch more as a precaution to future related pytest issues as well as an attempt to resolve #34 .