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

Run tests within the same python process #17

Merged
merged 7 commits into from
Jan 28, 2019

Conversation

jgsogo
Copy link
Contributor

@jgsogo jgsogo commented Jan 23, 2019

Hi! I want to share with you this trick to run the tests, I'm calling the Conan main function (not actually because it contains some sys.exit calls in case of failure) to run the commands.

We think this is almost the best approach to run the tests:

  • hooks are actually tested using actual Conan flow
  • we run the code for several Conan versions, we are checking not only the compatibility regarding the input parameters, but also the tools that could be used inside the hooks.
  • we can mock whatever we want, we are inside the same python process 💯

Let me know your thoughts about it.

@jgsogo jgsogo self-assigned this Jan 23, 2019
@jgsogo jgsogo added the enhancement New feature or request label Jan 23, 2019
self.assertEqual(return_code, expected_return_code,
msg="Unexpected return code\n\n{}".format(output_stream.getvalue()))
finally:
conan_api._remote_manager._auth_manager._localdb.connection.close() # Close sqlite3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conan is not closing the connection to the database 😮 , we need to close it in order to remove the working directory.

@uilianries
Copy link
Member

Sounds like integration tests.

@jgsogo jgsogo mentioned this pull request Jan 28, 2019
@danimtb
Copy link
Member

danimtb commented Jan 28, 2019

Quite smooth and seems the way to go! 👍

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jgsogo jgsogo merged commit b8dc5a9 into conan-io:master Jan 28, 2019
@jgsogo jgsogo deleted the feature/test-using-main branch January 28, 2019 15:13
danimtb pushed a commit to danimtb/hooks that referenced this pull request May 27, 2019
…shared_post_build

Removed shared artifacts check in post_build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants