Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource directories #71

Open
benjimin opened this issue Jun 4, 2019 · 0 comments
Open

resource directories #71

benjimin opened this issue Jun 4, 2019 · 0 comments

Comments

@benjimin
Copy link
Collaborator

benjimin commented Jun 4, 2019

Half of the tests contain this anti-pattern or boiler-plate, which ought not be needed:

try:
    import pathLocate
except:
    from unittests import pathLocate

# Add parent folder to python path
unittest_dir = pathLocate.getUnitTestDirectory()
sys.path.append(pathLocate.getRootDirectory())

The manipulation of sys.path should be unnecessary if the tests are invoked from an appropriate context.

Use of this approach (pathLocate inspects __file__) for finding absolute paths to resources (such as config files and test data) is discouraged in favour of importlib.resources (preferred) or pkg_resources (as noted in issue #65).

Also, unclear what unittests.pathLocate should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants