Skip to content

Write test fixtures as code instead of crafting by-hand #111

@ca-johnson

Description

@ca-johnson

The workflow for modifying test server fixture is to run unit tests, pause them halfway, make changes and save the resulting fixture. (See test_perforce.py:test_fixture)

Instead, it would be better to write as code:

server = setup_server()
server.add_stream("my-stream")

client = setup_client(server, stream="my-stream")
changelist = client.new_changelist()
changelist.add_file('file.txt', content="Hello World")
client.submit(changelist)

changelist = client.new_changelist()
changelist.add_file('file.txt', content="Goodbye World")
client.shelve(changelist)

This would setup a server with one stream, where a client submitted a changelist and holds a shelved changelist.

This way, we can more easily create and test different scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions