Skip to content

Organising the codebase #62

@willGraham01

Description

@willGraham01

Is Your Feature Request Related to a Problem? Please Describe

Currently our package codebase and test suite is a bit all over the place. The test suite has a lot of repeated setup that we would ideally move into fixtures, or into setup fixtures.

The package code itself has a number of files that contain multiple "important" classes that we should probably split out for our own sanity down the line.

TLDR; It is probably time to introduce some order.

Describe the Solution You'd Like

Test Suite

The test suite is the easy one to tackle, in which I propose we organise the test suite along the lines of:

tests/
    fixtures/
    test_unit/
    test_integration/
    conftest.py

We can setup conftest.py to automatically search the fixtures directory (and any sub-directories) for pytest.fixture objects, which all tests will have access to. We can also put any "utility fixtures" in here, like helpers for pytest.raise contexts.

test_unit can then follow the structure that we seem to largely be adhering to currently. Small unit tests for methods should go in here, or inside sub-folders appropriately. Personally I prefer one-test-file-per-method-being-tested, rather than one-file-per-class-or-module, doubly so since our test files already seem to be quite long.

test_integration may or may not be needed, but essentially serves as a space for some of our larger examples. Like when we eventually introduce #45 ?

Codebase Itself

Here, I think we just need to set some rules for how modular we are. Nothing is immediately pressing, though we could be a bit more modular with our files and where we define classes. The node.py file for example defines three classes, for example - these should probably be 3 separate files within their own sub(sub)module.

Describe Alternatives You've Considered

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions