Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ support/*
wheels/*
*.dist-info
__pycache__
tests/testbed/macOS
tests/testbed/iOS
testbed/build
testbed/logs
testbed/dist
venv*
14 changes: 14 additions & 0 deletions testbed/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Python Testbed
==============

A testbed to run the CPython test suite.

The test suite can be run with `Briefcase <https://briefcase.readthedocs.io/>`__:

* **macOS** `briefcase run --test`
* **iOS** `briefcase run iOS --test`

You can also pass in any command line arguments that the Python test suite honors: e.g.,

* **macOS** `briefcase run --test -- -u all,-largefile,-audio,-gui test_builtin`
* **iOS** `briefcase run iOS --test -- -u all,-largefile,-audio,-gui test_builtin`
58 changes: 58 additions & 0 deletions testbed/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This project was generated with Unknown using template: https://github.com/beeware/briefcase-template@v0.3.15
[tool.briefcase]
project_name = "Python Testbed"
bundle = "org.python"
version = "0.0.1"
url = "https://python.org/testbed"
license = "BSD license"
author = "Jane Developer"
author_email = "jane@python.org"

[tool.briefcase.app.testbed]
formal_name = "Python Testbed"
description = "The CPython test suite"
long_description = """More details about the app should go here.
"""
icon = "src/testbed/resources/testbed"
sources = [
"src/testbed",
]
test_sources = [
"tests",
]

requires = []
test_requires = []

[tool.briefcase.app.testbed.macOS]
requires = [
"std-nslog~=1.0.0"
]
support_package = "../dist/Python-3.11-macOS-support.test-custom.tar.gz"

# Mobile deployments
[tool.briefcase.app.testbed.iOS]
requires = [
"rubicon-objc~=0.4.6",
"std-nslog~=1.0.0",
]
support_package = "../dist/Python-3.11-iOS-support.test-custom.tar.gz"

[tool.briefcase.app.testbed.android]
sources = [
# "../path/to/python-src/Lib/test"
]
requires = [
]
# Is this needed?
# build_gradle_extra_content = "android.defaultConfig.python.extractPackages 'test'"

# Unsupported deployments
[tool.briefcase.app.testbed.linux]
supported = false

[tool.briefcase.app.testbed.windows]
supported = false

[tool.briefcase.app.testbed.web]
supported = false
Empty file added testbed/src/testbed/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions testbed/src/testbed/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from testbed.app import main

if __name__ == "__main__":
main()
28 changes: 28 additions & 0 deletions testbed/src/testbed/android.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
######################################################################
# Android App main loop
#
# The main loop itself is a no-op; however we need a PythonAppDelegate
# to satisfy the app stub.
#######################################################################
from rubicon.java import JavaClass, JavaInterface

# The Android cookiecutter template creates an app whose main Activity is
# called `MainActivity`. The activity assumes that we will store a reference
# to an implementation/subclass of `IPythonApp` in it.
MainActivity = JavaClass("org/beeware/android/MainActivity")

# The `IPythonApp` interface in Java allows Python code to
# run on Android activity lifecycle hooks such as `onCreate()`.
IPythonApp = JavaInterface("org/beeware/android/IPythonApp")


class PythonApp(IPythonApp):
def __init__(self, app):
super().__init__()
self._impl = app
MainActivity.setPythonApp(self)
print("Python app launched & stored in Android Activity class")


def main_loop():
pass
20 changes: 20 additions & 0 deletions testbed/src/testbed/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import importlib
import platform
import sys


def main():
print("=" * 80)
print(f"Python {platform.python_version()} Verification Suite")
print(f"Running on {platform.platform()}")
print("=" * 80)

# Load the platform module
if hasattr(sys, "getandroidapilevel"):
module_path = ".android"
else:
module_path = f".{sys.platform}"
platform_module = importlib.import_module(module_path, "testbed")

# Run the main_loop() for the platform
platform_module.main_loop()
6 changes: 6 additions & 0 deletions testbed/src/testbed/darwin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
######################################################################
# macOS App main loop
#######################################################################

def main_loop():
print("Did you forget to use --test?")
17 changes: 17 additions & 0 deletions testbed/src/testbed/ios.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
######################################################################
# iOS App main loop
#
# The main loop itself is a no-op; however we need a PythonAppDelegate
# to satisfy the app stub.
#######################################################################
from rubicon.objc import ObjCClass

UIResponder = ObjCClass("UIResponder")


class PythonAppDelegate(UIResponder):
pass


def main_loop():
print("Python app launched")
Empty file.
Binary file added testbed/src/testbed/resources/testbed-1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-167.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-256.ico
Binary file not shown.
Binary file added testbed/src/testbed/resources/testbed-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-29.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-58.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed-87.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added testbed/src/testbed/resources/testbed.icns
Binary file not shown.
Empty file added testbed/tests/__init__.py
Empty file.
28 changes: 28 additions & 0 deletions testbed/tests/testbed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
from pathlib import Path

from test.libregrtest import main
import faulthandler


def run_tests():
project_path = Path(__file__).parent.parent
os.chdir(project_path)

# Install a dummy traceback handler.
# faulthandler tries to use fileno on sys.stderr, which doesn't work on iOS
# because sys.stderr has been redirected to NSLog.
def dump_traceback_later(*args, **kwargs):
pass

faulthandler.dump_traceback_later = dump_traceback_later

try:
main()
except SystemExit as e:
returncode = e.code
print(f">>>>>>>>>> EXIT {returncode} <<<<<<<<<<")


if __name__ == "__main__":
run_tests()