Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fissix in order to support newer python versions #17

Merged
merged 12 commits into from
Apr 16, 2024
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.5", "3.6", "3.7.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.6", "3.7.7", "3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-20.04, macos-latest, windows-latest]

steps:
Expand Down
1 change: 1 addition & 0 deletions nose2pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.0.8"
13 changes: 6 additions & 7 deletions nose2pytest/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@

Requires Python 3.4.

This script relies heavily on lib2to3, using it to find patterns of code to transform and convert transformed
This script relies heavily on fissix, using it to find patterns of code to transform and convert transformed
code nodes back into Python source code. The following article was very useful:
http://python3porting.com/fixers.html#find-pattern.
"""

import sys
import argparse
import logging

from lib2to3 import refactor, fixer_base, pygram, pytree, pgen2
from lib2to3.pytree import Node as PyNode, Leaf as PyLeaf
from lib2to3.pgen2 import token
from pathlib import Path

from lib2to3.fixer_util import parenthesize
from fissix import refactor, fixer_base, pygram, pytree, pgen2
from fissix.pytree import Node as PyNode, Leaf as PyLeaf
from fissix.pgen2 import token
from fissix.fixer_util import parenthesize

__version__ = "1.0.10"

Expand Down Expand Up @@ -618,7 +617,7 @@ def __init__(self, verbose: bool = False):
super().__init__([], flags)
level = logging.DEBUG if verbose else logging.INFO
logging.basicConfig(format='%(name)s: %(message)s', level=level)
logger = logging.getLogger('lib2to3.main')
logger = logging.getLogger('fissix.main')

def get_fixers(self):
pre_fixers = []
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[bumpversion]
files = setup.py nose2pytest/script.py

files = setup.py nose2pytest/script.py
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
name='nose2pytest',
version='1.0.10',
packages=['nose2pytest'],
# py_modules=['assert_tools', 'nose2pytest'],
entry_points={
'console_scripts': [
'nose2pytest = nose2pytest.script:main',
Expand All @@ -18,8 +17,10 @@
author_email='[email protected]',
description='Convert nose.tools.assert_ calls found in your Nose test modules into raw asserts for pytest',
keywords='nose to pytest conversion',

python_requires='>=3.5',
install_requires=[
'fissix',
],
python_requires='>=3.6',
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
Expand All @@ -35,9 +36,6 @@
'License :: OSI Approved :: BSD License',

# Specify the Python versions you support here.
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand Down
6 changes: 3 additions & 3 deletions tools/find_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
from io import StringIO

# Local imports
from lib2to3 import pytree
from lib2to3.pgen2 import driver
from lib2to3.pygram import python_symbols, python_grammar
from fissix import pytree
from fissix.pgen2 import driver
from fissix.pygram import python_symbols, python_grammar

driver = driver.Driver(python_grammar, convert=pytree.convert)

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{35, 36, 37, 38, 39, 310, 311}
envlist = py{36, 37, 38, 39, 310, 311}

[testenv]
deps =
Expand Down
Loading