Repository: pypa/build
Pull request #163 (2020-10-24 21:49:14)

ci: pass pytest arguments via PYTEST_ADDOPTS
Signed-off-by: Filipe Laíns <lains@archlinux.org>


Patch:
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 5eb3704..aa5e133 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -25,7 +25,7 @@ jobs:
   pytest:
     runs-on: ${{ matrix.os }}-latest
     env:
-      PYTEST_ADDOPTS: "--showlocals -vv --durations=10"
+      PYTEST_ADDOPTS: "--run-integration --showlocals -vv --durations=10"
     strategy:
       fail-fast: false
       matrix:
@@ -78,13 +78,13 @@ jobs:
         run: tox -e ${{env.BASE}} --skip-pkg-install
 
       - name: Run test suite via path
-        run: tox -e ${{env.BASE}}-path --skip-pkg-install -- --run-integration
+        run: tox -e ${{env.BASE}}-path --skip-pkg-install
 
       - name: Run test suite via sdist
-        run: tox -e ${{env.BASE}}-sdist --skip-pkg-install -- --run-integration
+        run: tox -e ${{env.BASE}}-sdist --skip-pkg-install
 
       - name: Run test suite via wheel
-        run: tox -e ${{env.BASE}}-wheel --skip-pkg-install -- --run-integration
+        run: tox -e ${{env.BASE}}-wheel --skip-pkg-install
 
       - name: Rename coverage report file
         run: |
diff --git a/setup.cfg b/setup.cfg
index 3a8de65..e1e7000 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,7 @@
 [metadata]
 name = build
 version = 0.0.4
+description = A simple, correct PEP517 package builder
 long_description = file: README.md
 long_description_content_type = text/markdown
 author = Filipe Laíns
diff --git a/src/build/__init__.py b/src/build/__init__.py
index f441341..a2c0190 100644
--- a/src/build/__init__.py
+++ b/src/build/__init__.py
@@ -155,7 +155,7 @@ class ProjectBuilder(object):
 
         self._backend = self._build_system['build-backend']
 
-        self.hook = pep517.wrappers.Pep517HookCaller(
+        self._hook = pep517.wrappers.Pep517HookCaller(
             self.srcdir,
             self._backend,
             backend_path=self._build_system.get('backend-path'),
@@ -165,12 +165,12 @@ class ProjectBuilder(object):
     @property
     def python_executable(self):  # type: () -> Union[bytes, Text]
         # make mypy happy
-        exe = self.hook.python_executable  # type: Union[bytes, Text]
+        exe = self._hook.python_executable  # type: Union[bytes, Text]
         return exe
 
     @python_executable.setter
     def python_executable(self, value):  # type: (Union[bytes, Text]) -> None
-        self.hook.python_executable = value
+        self._hook.python_executable = value
 
     @property
     def build_dependencies(self):  # type: () -> Set[str]
@@ -180,7 +180,7 @@ class ProjectBuilder(object):
         """
         Returns a set of dependencies
         """
-        get_requires = getattr(self.hook, 'get_requires_for_build_{}'.format(distribution))
+        get_requires = getattr(self._hook, 'get_requires_for_build_{}'.format(distribution))
 
         try:
             with _working_directory(self.srcdir):
@@ -208,7 +208,7 @@ class ProjectBuilder(object):
         :param distribution: Distribution to build (sdist or wheel)
         :param outdir: Output directory
         """
-        build = getattr(self.hook, 'build_{}'.format(distribution))
+        build = getattr(self._hook, 'build_{}'.format(distribution))
         outdir = os.path.abspath(outdir)
 
         if os.path.exists(outdir):


Test patch:
diff --git a/tests/test_projectbuilder.py b/tests/test_projectbuilder.py
index 3304e06..1d38efa 100644
--- a/tests/test_projectbuilder.py
+++ b/tests/test_projectbuilder.py
@@ -136,7 +136,7 @@ def test_python_executable(test_flit_path, value):
 
     builder.python_executable = value
     assert builder.python_executable == value
-    assert builder.hook.python_executable == value
+    assert builder._hook.python_executable == value
 
 
 @pytest.mark.parametrize('distribution', ['wheel', 'sdist'])
@@ -172,8 +172,8 @@ def test_check_dependencies(mocker, test_flit_path):
     ]
 
     build.check_version.return_value = False
-    builder.hook.get_requires_for_build_sdist.side_effect = copy.copy(side_effects)
-    builder.hook.get_requires_for_build_wheel.side_effect = copy.copy(side_effects)
+    builder._hook.get_requires_for_build_sdist.side_effect = copy.copy(side_effects)
+    builder._hook.get_requires_for_build_wheel.side_effect = copy.copy(side_effects)
 
     # requires = []
     assert builder.check_dependencies('sdist') == {'flit_core >=2,<3'}
@@ -203,15 +203,15 @@ def test_build(mocker, test_flit_path, tmp_dir):
 
     builder = build.ProjectBuilder(test_flit_path)
 
-    builder.hook.build_sdist.side_effect = [None, Exception]
-    builder.hook.build_wheel.side_effect = [None, Exception]
+    builder._hook.build_sdist.side_effect = [None, Exception]
+    builder._hook.build_wheel.side_effect = [None, Exception]
 
     builder.build('sdist', tmp_dir)
-    builder.hook.build_sdist.assert_called_with(tmp_dir, {})
+    builder._hook.build_sdist.assert_called_with(tmp_dir, {})
     build._working_directory.assert_called_with(test_flit_path)
 
     builder.build('wheel', tmp_dir)
-    builder.hook.build_wheel.assert_called_with(tmp_dir, {})
+    builder._hook.build_wheel.assert_called_with(tmp_dir, {})
     build._working_directory.assert_called_with(test_flit_path)
 
     with pytest.raises(build.BuildBackendException):
@@ -277,7 +277,7 @@ def test_relative_outdir(mocker, tmp_dir, test_flit_path):
 
     builder.build('sdist', '.')
 
-    builder.hook.build_sdist.assert_called_with(os.path.abspath('.'), {})
+    builder._hook.build_sdist.assert_called_with(os.path.abspath('.'), {})
 
 
 def test_not_dir_outdir(mocker, tmp_dir, test_flit_path):