Building/distribution, demonstration, and acceptance

The build process for the individual modules will not have changed much, though with unit tests now available, those can be added to the setup.py files that are used to package the individual Python packages. The setup function that's already in place can, with minimal changes, be used to execute the entire test suite simply by providing a test_suite argument that points to the root test suite directory.

It may be necessary to ensure that the path to the test suite directory has been added to sys.path as well:

#!/usr/bin/env python

import sys
sys.path.append('../standards')
sys.path.append('tests/test_hms_core') # <-- This path

The current setup function call, then, includes test_suite like this:

setup(
    name='HMS-Core',
    version='0.1.dev0',
    author='Brian D. Allbee',
    description='',
    package_dir={
        '':'src',
    },
    packages=[
        'hms_core',
    ],
    test_suite='tests.test_hms_core',
)

The entire test suite can then be executed with python setup.py test, which returns a line-by-line summary of the tests executed and their results:

Packaging the code in a component project still uses python setup.py sdist from within the individual project directories, and still yields an installable package:

Demonstrating the new data-persistence functionality could be done in several ways, but requires the creation of disposable/temporary demo data objects in a disposable/temporary database. There's code in the test_co_objects test module that does just that, so creating a minimal data object class based on that structure (calling it ExampleObject for demonstrative purposes), then running:

HMSMongoDataObject.configure(
    DatastoreConfig(database='demo_data')
)

print('Creating data-objects to demo with')
names = ['Alice', 'Bob', 'Carl', 'Doug']
costs = [1, 2, 3]
descriptions = [None, 'Description']
for name in names:
    for description in descriptions:
        for cost in costs:
            item = ExampleObject(
                name=name, description=description, cost=cost
            )
            item.save()

It takes care of generating a dataset that can be examined. From that point, any tool  the command-line mongo client or a GUI, such as Robo3T – can be used to view and verify that data was, in fact, persisted:

If more detailed acceptance examples are needed – such as examples for each of the business object types  a similar script could be written to create Artisan and Product instances and save them as well. Similarly, with respect to the hms_artisan data object classes, simply showing the files written for objects in an example/demo environment should suffice.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.54.7