Skip to content

resource directories #71

Open
Open
@benjimin

Description

@benjimin

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions