Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Failtest_installation on warnings, and remove deprecated license classifier#2054

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletionsetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,7 +95,6 @@ def _stamp_version(filename: str) -> None:
# "Development Status :: 7 - Inactive",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
Expand Down
76 changes: 38 additions & 38 deletionstest/test_installation.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import ast
import functools
import os
import subprocess

Expand All@@ -11,50 +12,22 @@
class TestInstallation(TestBase):
@with_rw_directory
def test_installation(self, rw_dir):
venv = self._set_up_venv(rw_dir)
venv, run = self._set_up_venv(rw_dir)

result = subprocess.run(
[venv.pip, "install", "."],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
self.assertEqual(
0,
result.returncode,
msg=result.stderr or result.stdout or "Can't install project",
)
result = run([venv.pip, "install", "."])
self._check_result(result, "Can't install project")

result = subprocess.run(
[venv.python, "-c", "import git"],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
self.assertEqual(
0,
result.returncode,
msg=result.stderr or result.stdout or "Self-test failed",
)
result = run([venv.python, "-c", "import git"])
self._check_result(result, "Self-test failed")

result = subprocess.run(
[venv.python, "-c", "import gitdb; import smmap"],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
self.assertEqual(
0,
result.returncode,
msg=result.stderr or result.stdout or "Dependencies not installed",
)
result = run([venv.python, "-c", "import gitdb; import smmap"])
self._check_result(result, "Dependencies not installed")

# Even IF gitdb or any other dependency is supplied during development by
# inserting its location into PYTHONPATH or otherwise patched into sys.path,
# make sure it is not wrongly inserted as the *first* entry.
result = subprocess.run(
[venv.python, "-c", "import sys; import git; print(sys.path)"],
stdout=subprocess.PIPE,
cwd=venv.sources,
)
syspath = result.stdout.decode("utf-8").splitlines()[0]
result = run([venv.python, "-c", "import sys; import git; print(sys.path)"])
syspath = result.stdout.splitlines()[0]
syspath = ast.literal_eval(syspath)
self.assertEqual(
"",
Expand All@@ -64,10 +37,37 @@ def test_installation(self, rw_dir):

@staticmethod
def _set_up_venv(rw_dir):
# Initialize the virtual environment.
venv = VirtualEnvironment(rw_dir, with_pip=True)

# Make its src directory a symlink to our own top-level source tree.
os.symlink(
os.path.dirname(os.path.dirname(__file__)),
venv.sources,
target_is_directory=True,
)
return venv

# Create a convenience function to run commands in it.
run = functools.partial(
subprocess.run,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
cwd=venv.sources,
env={**os.environ, "PYTHONWARNINGS": "error"},
)

return venv, run

def _check_result(self, result, failure_summary):
self.assertEqual(
0,
result.returncode,
msg=self._prepare_failure_message(result, failure_summary),
)

@staticmethod
def _prepare_failure_message(result, failure_summary):
stdout = result.stdout.rstrip()
stderr = result.stderr.rstrip()
return f"{failure_summary}\n\nstdout:\n{stdout}\n\nstderr:\n{stderr}"
Loading

[8]ページ先頭

©2009-2025 Movatter.jp