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

Python API #2

Open
sebastian-philipp opened this issue Sep 19, 2019 · 1 comment
Open

Python API #2

sebastian-philipp opened this issue Sep 19, 2019 · 1 comment

Comments

@sebastian-philipp
Copy link

I ended up using something like

import distutils
import subprocess

from setuptools import setup

class MkCodesCommand(distutils.cmd.Command):
  """A custom command to run MkCodes."""

  description = 'run mkcodes'
  user_options:list = []

  def initialize_options(self):
      pass

  def finalize_options(self):
      pass

  def run(self):
    """Run command."""
    subprocess.check_call('mkcodes --github --output rook_ceph_client/tests/test_{name}.py README.md'.split())


setup(
    ...
    cmdclass={
        'mkcodes': MkCodesCommand,
    },
)

would be nice to have a better recipe / integration provided as an example

@sebastian-philipp sebastian-philipp changed the title pytest integration setup.py integration Sep 19, 2019
@ryneeverett ryneeverett changed the title setup.py integration Python API Feb 23, 2020
@ryneeverett
Copy link
Owner

I've modified the tests to use click's CliRunner class rather than subprocess, which should work for your use case as well. Perhaps we should expose a thin wrapper around CliRunner.

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

2 participants