Skip to content

Commit

Permalink
Refactor use_package_config=True to omit_package_config_in_test=False.
Browse files Browse the repository at this point in the history
This makes the intention clear.
  • Loading branch information
mauritsvanrees committed Jul 12, 2023
1 parent 8aed13a commit 15c0445
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions zest/releaser/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def load_configs(self, pypirc_config_filename=DIST_CONFIG_FILE):
pyproject_config = PyprojectTomlConfig()
combined_config = {}
config_files = [pypi_config]
if self.use_package_config:
if not self.omit_package_config_in_test:
config_files.extend([setup_config, pyproject_config])
for config in config_files:
if config.zest_releaser_config() is not None:
Expand All @@ -328,9 +328,9 @@ def load_configs(self, pypirc_config_filename=DIST_CONFIG_FILE):
self.config = combined_config

def __init__(
self, pypirc_config_filename=DIST_CONFIG_FILE, use_package_config=True
self, pypirc_config_filename=DIST_CONFIG_FILE, omit_package_config_in_test=False
):
self.use_package_config = use_package_config
self.omit_package_config_in_test = omit_package_config_in_test
self.load_configs(pypirc_config_filename=pypirc_config_filename)

def want_release(self):
Expand Down
4 changes: 2 additions & 2 deletions zest/releaser/tests/pypi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ zest.releaser, which now contains a setup.cfg.

We can ask for the result like this, which by default is True:

>>> zestreleaserconfig = pypi.ZestReleaserConfig(pypirc_config_filename=pypirc_both, use_package_config=False)
>>> zestreleaserconfig = pypi.ZestReleaserConfig(pypirc_config_filename=pypirc_both, omit_package_config_in_test=True)
>>> zestreleaserconfig.create_wheel()
True

We can also specify to not create the wheel, even when (universal) wheels could be created:

>>> pypirc_no_create = pkg_resources.resource_filename(
... 'zest.releaser.tests', 'pypirc_universal_nocreate.txt')
>>> zestreleaserconfig = pypi.ZestReleaserConfig(pypirc_config_filename=pypirc_no_create, use_package_config=False)
>>> zestreleaserconfig = pypi.ZestReleaserConfig(pypirc_config_filename=pypirc_no_create, omit_package_config_in_test=True)
>>> zestreleaserconfig.create_wheel()
False

Expand Down

0 comments on commit 15c0445

Please sign in to comment.