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

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

Open
ca-johnson opened this issue Aug 19, 2019 · 0 comments
Open

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

ca-johnson opened this issue Aug 19, 2019 · 0 comments

Comments

@ca-johnson
Copy link
Contributor

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.

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

No branches or pull requests

1 participant