Skip to content

Conversation

@tonybaloney
Copy link
Contributor

Opening early since this probably deserves discussion..

When developing PyTest plugins, having to write the tests in string literals is tricky and loses out on syntax highlighting etc.
This change proposes adding a helper function where a function can be declared and the source code within the function will be written to the temporary test file instead.

e.g.

def test_makepyfilefunc(testdir):
    """Test makepyfilefunc against an inline function declaration"""
    def tests():
        def test_foo():
            assert True
    
    test_mod = testdir.makepyfilefunc(tests)
    result = testdir.inline_run(str(test_mod))
    assert result.ret == EXIT_OK
  • Create a new changelog file in the changelog folder, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.
  • Target the master branch for bug fixes, documentation updates and trivial changes.
  • Target the features branch for new features and removals/deprecations.
  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.

Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:

  • Add yourself to AUTHORS in alphabetical order;

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

I recently started to move those into actual files, as it allows direct execution

@nicoddemus
Copy link
Member

Yep, @tonybaloney please take a look at #3636 and feel free to give feedback there.

@tonybaloney tonybaloney closed this Jul 4, 2018
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

Successfully merging this pull request may close these issues.

3 participants