Skip to content
Merged
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
11 changes: 9 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
name: run-tests
on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- main
- master
- development
pull_request:
workflow_dispatch:
jobs:
build:
name: Run tests
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 1 addition & 3 deletions devtools/gearbox/quickstart/command.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import re
import os
import shutil
Expand Down Expand Up @@ -244,4 +242,4 @@ def safe_name(name: str) -> str:

from setuptools.pkg_resources.safe_name
"""
return re.sub('[^A-Za-z0-9.]+', '-', name)
return re.sub('[^A-Za-z0-9.]+', '-', name)
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class RootController(BaseController):
redirect('/login',
params=dict(came_from=came_from, __logins=login_counter))
userid = request.identity['repoze.who.userid']
flash(_('Welcome back, %s!') % userid)
flash(_('Welcome back, {}!').format(userid))

# Do not use tg.redirect with tg.url as it will add the mountpoint
# of the application twice.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def current_year():


def icon(icon_name):
return Markup('<i class="glyphicon glyphicon-%s"></i>' % icon_name)
return Markup(f'<i class="glyphicon glyphicon-{icon_name}"></i>')


# Import commonly used helpers from WebHelpers2 and TG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Group(DeclarativeBase):
users = relationship('User', secondary=user_group_table, backref='groups')

def __repr__(self):
return '<Group: name=%s>' % repr(self.group_name)
return f'<Group: name={self.group_name!r}>'

def __unicode__(self):
return self.group_name
Expand All @@ -96,11 +96,7 @@ class User(DeclarativeBase):
created = Column(DateTime, default=datetime.now)

def __repr__(self):
return '<User: name=%s, email=%s, display=%s>' % (
repr(self.user_name),
repr(self.email_address),
repr(self.display_name)
)
return f'<User: name={self.user_name!r}, email={self.email_address!r}, display={self.display_name!r}>'

def __unicode__(self):
return self.display_name or self.user_name
Expand Down Expand Up @@ -185,7 +181,7 @@ class Permission(DeclarativeBase):
backref='permissions')

def __repr__(self):
return '<Permission: name=%s>' % repr(self.permission_name)
return f'<Permission: name={self.permission_name!r}>'

def __unicode__(self):
return self.permission_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ application_name = 'main_without_authn'

def load_app(name=application_name):
"""Load the test application."""
return TestApp(loadapp('config:test.ini#%s' % name, relative_to=getcwd()))
return TestApp(loadapp(f'config:test.ini#{name}', relative_to=getcwd()))


def setup_app():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ As {{project}} grows and the authentication method changes, only these tests
should be updated.

"""
from __future__ import unicode_literals

from {{package}}.tests import TestController


Expand Down Expand Up @@ -36,7 +34,7 @@ class TestAuthentication(TestController):
home_page = post_login.follow(status=302)
assert (
'authtkt' in home_page.request.cookies
), 'Session cookie was not defined: %s' % home_page.request.cookies
), f'Session cookie was not defined: {home_page.request.cookies}'
assert home_page.location, 'http://localhost/'

def test_logout(self):
Expand All @@ -47,7 +45,7 @@ class TestAuthentication(TestController):
resp = resp.follow(status=302)
assert (
'authtkt' in resp.request.cookies
), 'Session cookie was not defined: %s' % resp.request.cookies
), f'Session cookie was not defined: {resp.request.cookies}'
# Logging out:
resp = self.app.get('/logout_handler', status=302)
assert resp.location.startswith('http://localhost/post_logout')
Expand All @@ -56,7 +54,7 @@ class TestAuthentication(TestController):
authtkt = home_page.request.cookies.get('authtkt')
assert (
not authtkt or authtkt == 'INVALID'
), 'Session cookie was not deleted: %s' % home_page.request.cookies
), f'Session cookie was not deleted: {home_page.request.cookies}'
assert home_page.location == 'http://localhost/'

def test_failed_login_keeps_username(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestRootController(TestController):
assert msg in response

# You can also access a BeautifulSoup'ed response in your tests
# (First run $ easy_install BeautifulSoup
# (First run `pip install beautifulsoup4`
# and then uncomment the next two lines)

# links = response.html.findAll('a')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
"""Test suite for the TG app's models"""
from __future__ import unicode_literals

from {{package}} import model
from {{package}}.tests.models import ModelTest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
"""Setup the {{project}} application"""
from __future__ import print_function, unicode_literals

{{if sqlalchemy}}
import transaction
{{endif}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
"""Setup the {{project}} application"""
from __future__ import print_function

from tg import config
{{if sqlalchemy}}
import transaction
Expand Down Expand Up @@ -32,4 +30,4 @@ def setup_schema(command, conf, vars):
alembic_cfg.set_main_option("sqlalchemy.url", config['sqlalchemy.url'])
import alembic.command
alembic.command.stamp(alembic_cfg, "head")
{{endif}}
{{endif}}
1 change: 0 additions & 1 deletion devtools/gearbox/quickstart/template/migration/env.py_tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool

Expand Down
4 changes: 0 additions & 4 deletions devtools/gearbox/quickstart/template/setup.py_tmpl

This file was deleted.

7 changes: 1 addition & 6 deletions devtools/gearbox/sqlamigrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,9 @@
check http://code.google.com/p/sqlalchemy-migrate/wiki/MigrateVersioning for detail.

"""
from __future__ import print_function
from configparser import ConfigParser
from gearbox.command import Command

try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser

import sys, os

class MigrateCommand(Command):
Expand Down
2 changes: 0 additions & 2 deletions devtools/gearbox/tgext/command.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

from gearbox.command import TemplateCommand
import re, getpass

Expand Down
4 changes: 2 additions & 2 deletions devtools/gearbox/tgext/template/pyproject.toml_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ name = {{repr(package)}}
version = "{{version}}"
description = "{{description or ''}}"
readme = { file = "README.rst", content-type = "text/x-rst" }
requires-python = ">=3.8"
classifiers = [] # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords = {{repr(keywords or '')}}
keywords = [{{repr(keywords or '')}}]
authors = [
{ name = {{repr(author or '')}}, email = {{repr(author_email or '')}} }
]
Expand All @@ -24,4 +25,3 @@ exclude = ["ez_setup", "examples", "tests"]
[tool.setuptools]
include-package-data = true
zip-safe = false
namespace_packages = ["tgext"]
7 changes: 0 additions & 7 deletions devtools/gearbox/tgext/template/tgext/__init__.py

This file was deleted.

8 changes: 3 additions & 5 deletions devtools/gearbox/tgshell.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os, sys
import tg

Expand Down Expand Up @@ -71,9 +69,9 @@ def take_action(self, opts):
if self._can_import(helpers_module):
locs['h'] = sys.modules[helpers_module]

exec ('import tg') in locs
exec ('from tg import app_globals, config, request, response, '
'session, tmpl_context, url') in locs
exec('import tg', locs)
exec('from tg import app_globals, config, request, response, '
'session, tmpl_context, url', locs)
locs.pop('__builtins__', None)

# Import all objects from the base module
Expand Down
1 change: 0 additions & 1 deletion devtools/tests/test_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


PY_VERSION = sys.version_info[:2]
PY2 = sys.version_info[0] == 2
PROJECT_NAME = 'TGTest-%02d'
ENV_NAME = 'TESTENV'
CLEANUP = True
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build-backend = "setuptools.build_meta"
name = "tg.devtools"
version = "2.5.1dev1"
description = "TurboGears 2 DevTools is a command-line toolkit that streamlines TurboGears2 development."
requires-python = ">=3.10"
readme = { file = "README.rst", content-type = "text/x-rst" }
keywords = ["turbogears", "devtools", "cli", "scaffold", "gearbox"]
classifiers = []
Expand Down
Loading