Skip to content
Permalink
Browse files

Merge pull request #485 from bitprophet/invoke

Attempted switch to unreleased Invoke
  • Loading branch information
alex committed Mar 18, 2013
2 parents 11584ed + 5304087 commit 7140ca0b9d51cff48d6158968a618d0a208902fc
Showing with 46 additions and 44 deletions.
  1. +4 −4 .travis.yml
  2. +8 −8 docs/contributing.rst
  3. +0 −1 fabfile/__init__.py
  4. +0 −16 fabfile/base.py
  5. +1 −1 requirements.txt
  6. +6 −0 tasks/__init__.py
  7. +13 −0 tasks/base.py
  8. +2 −2 {fabfile → tasks}/specs.py
  9. +12 −12 {fabfile → tasks}/travis.py
@@ -13,10 +13,10 @@ env:
# allow_failures:
# - env: TEST_TYPE=rubyspec_untranslated
install:
- pip install --use-mirrors fabric requests
- fab travis.install_requirements
script: fab travis.run_tests
after_success: fab travis.upload_build
- pip install --use-mirrors requests invoke
- invoke travis.install_requirements
script: invoke travis.run_tests
after_success: invoke travis.upload_build
notifications:
email: false
irc: "irc.freenode.org#topaz"
@@ -61,35 +61,35 @@ will verify for every pull request that it compiles and tests pass.
Running Rubyspecs
~~~~~~~~~~~~~~~~~

To run Rubyspecs, you can use the provided ``fab`` tasks. To get ``fab`` you
must have `Fabric`_ installed. The `rubyspec`_ and `mspec`_
To run Rubyspecs, you can use the provided ``invoke`` tasks. To get ``invoke`` you
must have `Invoke`_ installed. The `rubyspec`_ and `mspec`_
repositories have to be checked out next to your topaz repository, the spec
tasks will clone them for you if they aren't already there.

To just run all specs that should pass::

$ fab specs.run
$ invoke specs.run

You can also pass additional options, or run just a subset of the specs::

$ fab specs.run:options="-V --format dotted",files=../rubyspec/core/array
$ invoke specs.run --options="-V --format dotted" --files=../rubyspec/core/array

If you encounter failures that you need to tag::

$ fab specs.tag:files=../rubyspec/path/to/failing_spec.rb
$ invoke specs.tag --files=../rubyspec/path/to/failing_spec.rb

Not that you cannot tag specs that fail or error during load or setup,
to skip those you have to add them to the list of skipped specs in
``topaz.mspec``.

If you implemented a new feature, and want to untag the specs that now pass::

$ fab specs.untag:files=../rubyspec/path/to/failing_spec.rb
$ invoke specs.untag --files=../rubyspec/path/to/failing_spec.rb

And finally, during development, you may find it useful to run the
specs untranslated::

$ fab specs.run:translated=False,files=../rubyspec/core/array/new_spec.rb
$ invoke specs.run --translated=False --files=../rubyspec/core/array/new_spec.rb

Adding yourself to the authors file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -98,6 +98,6 @@ When you submit your first patch, add your name to the ``AUTHORS.rst`` file,
you've earned it!


.. _`Fabric`: http://fabfile.org
.. _`Invoke`: http://pyinvoke.org
.. _`rubyspec`: https://github.com/rubyspec/rubyspec
.. _`mspec`: https://github.com/rubyspec/mspec

This file was deleted.

This file was deleted.

@@ -1,5 +1,5 @@
rply
# Only a test requirement
pytest
fabric
invoke
requests
@@ -0,0 +1,6 @@
from invoke import Collection

from tasks import travis, specs


ns = Collection(travis, specs)
@@ -0,0 +1,13 @@
import os

from invoke import run


class BaseTest(object):
def download_mspec(self):
if not os.path.isdir("../mspec"):
run("cd .. && git clone --depth=100 --quiet https://github.com/rubyspec/mspec")

def download_rubyspec(self):
if not os.path.isdir("../rubyspec"):
run("cd .. && git clone --depth=100 --quiet https://github.com/rubyspec/rubyspec")
@@ -1,4 +1,4 @@
from fabric.api import task, local
from invoke import task, run as run_

from .base import BaseTest

@@ -13,7 +13,7 @@ def __init__(self, files, options, translated=True):
self.download_rubyspec()

def mspec(self, args):
local("../mspec/bin/mspec %s -t %s --config=topaz.mspec %s" % (args, self.exe, self.files))
run_("../mspec/bin/mspec %s -t %s --config=topaz.mspec %s" % (args, self.exe, self.files))

def run(self):
self.mspec("run -G fails %s" % self.options)
@@ -3,7 +3,7 @@
import struct
import sys

from fabric.api import task, local
from invoke import task, run

import requests

@@ -21,11 +21,11 @@ def __init__(self, func, deps=[], needs_rpython=True, needs_rubyspec=False,
self.create_build = create_build

def install_deps(self):
local("pip install --use-mirrors {}".format(" ".join(self.deps)))
run("pip install --use-mirrors {}".format(" ".join(self.deps)))

def download_rpython(self):
local("wget https://bitbucket.org/pypy/pypy/get/default.tar.bz2 -O `pwd`/../pypy.tar.bz2 || wget https://bitbucket.org/pypy/pypy/get/default.tar.bz2 -O `pwd`/../pypy.tar.bz2")
local("tar -xf `pwd`/../pypy.tar.bz2 -C `pwd`/../")
run("wget https://bitbucket.org/pypy/pypy/get/default.tar.bz2 -O `pwd`/../pypy.tar.bz2 || wget https://bitbucket.org/pypy/pypy/get/default.tar.bz2 -O `pwd`/../pypy.tar.bz2")
run("tar -xf `pwd`/../pypy.tar.bz2 -C `pwd`/../")
[path_name] = glob.glob("../pypy-pypy*")
path_name = os.path.abspath(path_name)
with open("rpython_marker", "w") as f:
@@ -52,7 +52,7 @@ def upload_build(self):
else:
raise ValueError("Don't recognize platform: {!r}".format(sys.platform))
build_name = "topaz-{platform}-{sha1}.tar.bz2".format(platform=platform, sha1=os.environ["TRAVIS_COMMIT"])
local("python topaz/tools/make_release.py {}".format(build_name))
run("python topaz/tools/make_release.py {}".format(build_name))
with open(build_name) as f:
response = requests.post("http://www.topazruby.com/builds/create/", {
"build_secret": os.environ["BUILD_SECRET"],
@@ -83,12 +83,12 @@ def run_tests():

@task
def tag_specs(files=""):
local("../mspec/bin/mspec tag -t {} -f spec --config=topaz.mspec {}".format("`pwd`/bin/topaz", files))
run("../mspec/bin/mspec tag -t {} -f spec --config=topaz.mspec {}".format("`pwd`/bin/topaz", files))


@task
def untag_specs(files=""):
local("../mspec/bin/mspec tag --del fails -t {} -f spec --config=topaz.mspec {}".format("`pwd`/bin/topaz", files))
run("../mspec/bin/mspec tag --del fails -t {} -f spec --config=topaz.mspec {}".format("`pwd`/bin/topaz", files))


@task
@@ -99,28 +99,28 @@ def upload_build():


def run_own_tests(env):
local("PYTHONPATH=$PYTHONPATH:{rpython_path} py.test".format(**env))
run("PYTHONPATH=$PYTHONPATH:{rpython_path} py.test".format(**env))


def run_rubyspec_untranslated(env):
run_specs("bin/topaz_untranslated.py", prefix="PYTHONPATH=$PYTHONPATH:{rpython_path} ".format(**env))


def run_translate_tests(env):
local("PYTHONPATH={rpython_path}:$PYTHONPATH python {rpython_path}/rpython/bin/rpython --batch -Ojit targettopaz.py".format(**env))
run("PYTHONPATH={rpython_path}:$PYTHONPATH python {rpython_path}/rpython/bin/rpython --batch -Ojit targettopaz.py".format(**env))
run_specs("`pwd`/bin/topaz")
local("PYTHONPATH={rpython_path}:$PYTHONPATH py.test --topaz=bin/topaz tests/jit/".format(**env))
run("PYTHONPATH={rpython_path}:$PYTHONPATH py.test --topaz=bin/topaz tests/jit/".format(**env))


def run_specs(binary, prefix=""):
local("{prefix}../mspec/bin/mspec -G fails -t {binary} --format=dotted --config=topaz.mspec".format(
run("{prefix}../mspec/bin/mspec -G fails -t {binary} --format=dotted --config=topaz.mspec".format(
prefix=prefix,
binary=binary
))


def run_docs_tests(env):
local("sphinx-build -W -b html docs/ docs/_build/")
run("sphinx-build -W -b html docs/ docs/_build/")

TEST_TYPES = {
"own": Test(run_own_tests, deps=["-r requirements.txt"]),

0 comments on commit 7140ca0

Please sign in to comment.