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

Python 3 fixes #103

Closed
wants to merge 1 commit into from
Closed

Python 3 fixes #103

wants to merge 1 commit into from

Conversation

jonashaag
Copy link

Makes django-nose Django1.5/Python3 compatible. Includes some changes automatically made by 2to3 that are not required for Python2 but don't hurt either (assuming only Python >= 2.6 compatibility is required). This way it's not necessary to run 2to3 on the codebase.

@jonashaag
Copy link
Author

Requires https://bitbucket.org/aaugustin/south-python3 to run the tests

@miki725
Copy link

miki725 commented Mar 22, 2013

Any progress here? I am trying to test one of my apps in Python 3 but I use django_nose testrunner which fails in Python 3.

@fabiosantoscode
Copy link
Contributor

Do you have any error information or stack traces you can show?
On 22 Mar 2013 18:25, "Miroslav Shubernetskiy" notifications@github.com
wrote:

Any progress here? I am trying to test one of my apps in Python 3 but I use
django_nose testrunner which fails in Python 3.


Reply to this email directly or view it on
GitHubhttps://github.com//pull/103#issuecomment-15313456
.

@miki725
Copy link

miki725 commented Mar 22, 2013

django-nose has syntax errors which are incompatible with Python3. My initial question was regarding the progress of merging this pull request into django-nose core since it seems to solve all the compatibility issues.

As requested here is a stack trace. In order to get it you don't even have to try to run the testrunner. I get it even during django-nose install:

(py33) $ pip install django-nose
Downloading/unpacking django-nose
  Downloading django-nose-1.1.tar.gz
  Running setup.py egg_info for package django-nose

    warning: no previously-included files matching '*.py[co]' found under directory 'django_nose'
    warning: no previously-included files matching '*.py[co]' found under directory 'testapp'
Requirement already satisfied (use --upgrade to upgrade): nose>=1.0 in /Volumes/Data/Users/miki725/.virtualenvs/py33/lib/python3.3/site-packages (from django-nose)
Requirement already satisfied (use --upgrade to upgrade): Django>=1.2 in /Volumes/Data/Users/miki725/.virtualenvs/py33/lib/python3.3/site-packages (from django-nose)
Installing collected packages: django-nose
  Running setup.py install for django-nose

    warning: no previously-included files matching '*.py[co]' found under directory 'django_nose'
    warning: no previously-included files matching '*.py[co]' found under directory 'testapp'
      File "/Volumes/Data/Users/miki725/.virtualenvs/py33/lib/python3.3/site-packages/django_nose/runner.py", line 70
        except ImportError, e:
                          ^
    SyntaxError: invalid syntax

Successfully installed django-nose
Cleaning up...

Obviously due to syntax error the testrunner would not run even though django-nose installs. To test the pull request, I did the following:

(py33) $ pip install -e git+https://github.com/jonashaag/django-nose@python3#egg=django-nose
Obtaining django-nose from git+https://github.com/jonashaag/django-nose@python3#egg=django-nose
  Cloning https://github.com/jonashaag/django-nose (to python3) to /Volumes/Data/Users/miki725/.virtualenvs/py33/src/django-nose
  Running setup.py egg_info for package django-nose

    warning: no previously-included files matching '*.py[co]' found under directory 'django_nose'
    warning: no previously-included files matching '*.py[co]' found under directory 'testapp'
Requirement already satisfied (use --upgrade to upgrade): nose>=1.2.1 in /Volumes/Data/Users/miki725/.virtualenvs/py33/lib/python3.3/site-packages (from django-nose)
Requirement already satisfied (use --upgrade to upgrade): Django>=1.2 in /Volumes/Data/Users/miki725/.virtualenvs/py33/lib/python3.3/site-packages (from django-nose)
Installing collected packages: django-nose
  Running setup.py develop for django-nose

    warning: no previously-included files matching '*.py[co]' found under directory 'django_nose'
    warning: no previously-included files matching '*.py[co]' found under directory 'testapp'
    Creating /Volumes/Data/Users/miki725/.virtualenvs/py33/lib/python3.3/site-packages/django-nose.egg-link (link to .)
    Adding django-nose 1.1 to easy-install.pth file

    Installed /Volumes/Data/Users/miki725/.virtualenvs/py33/src/django-nose
Successfully installed django-nose
Cleaning up...

As you can see the installation goes fine. I also ran the tests for my app and everything went fine as well. So this pull request seems to solve the Python 3 compatibility issues.

@fabiosantoscode
Copy link
Contributor

are we able to achieve python3 compatibility without breaking python25 compatibility? Some people might be using it still.

@jonashaag
Copy link
Author

Have you guys tried my patch?

@miki725
Copy link

miki725 commented Mar 22, 2013

@jonashaag I did and it works fine in Python 3.3 (illustrated here). Thanx

@fabiosantoscode I think it's possible but it makes things much more complicated. But in general I don't think it's an issue because as of 1.5, Django no longer supports Python 2.5 (release notes). Is this the only hold-up for merging this pull request?

@fabiosantoscode
Copy link
Contributor

I haven't tried the patch yet because I am still on django 1.4 and Python 2. I'll try it out now though.

@fabiosantoscode
Copy link
Contributor

@jonashaag The patch looks good to me. I have tested it on Python 3.3 and 2.7.3 with Django 1.5.

@miki725 I know python 25 support was dropped. I was only speculating. I think Python 3 support should be a priority, but I don't call the shots.

@fabiosantoscode
Copy link
Contributor

I've found that test --with-profile works not. I get:

manage.py: error: no such option: --with-cprofile

The python2 version works correctly, but I don't know if this is a bug in this patch.

@jbalogh
Copy link
Contributor

jbalogh commented Jun 20, 2013

Fixed with a mix of this patch and the patch from #127 in cff3b1c...4908503

@jbalogh jbalogh closed this Jun 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants