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

Unable to run py.test for the default `populus init` project #431

Closed
postables opened this issue Jan 11, 2018 · 14 comments

Comments

Projects
None yet
6 participants
@postables
Copy link

commented Jan 11, 2018

Im following tutorial and after running populus init I ran populus compile. I'm trying to get the default tests to run but get the following error

py.test tests/ --populus-project $(pwd)
=============================================== test session starts ================================================
platform linux -- Python 3.6.4, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /home/solidity/Documents/testing, inifile:
plugins: xdist-1.18.1, hypothesis-3.44.14, populus-2.2.0
collected 2 items

tests/test_greeter.py EE

====================================================== ERRORS ======================================================
__________________________________________ ERROR at setup of test_greeter __________________________________________

request = <SubRequest 'project' for <Function 'test_greeter'>>
pytestconfig = <_pytest.config.Config object at 0x7fd997d59b00>

@pytest.fixture()
def project(request, pytestconfig):
    project_dir = get_populus_option(
        cmdline_option="--populus-project",
        ini_option="populus_project",
        environ_var="PYTEST_POPULUS_PROJECT",
        pytestconfig=pytestconfig,
        default=os.getcwd(),
    )

    if not os.path.exists(get_json_config_file_path(project_dir)):
        raise FileNotFoundError(
            "No populus project found for testing in {project_dir}".format(
              project_dir=project_dir
            )
        )

E FileNotFoundError: No populus project found for testing in /home/solidity/Documents/testing

/usr/lib/python3.6/site-packages/populus-2.2.0-py3.6.egg/populus/plugin.py:60: FileNotFoundError
______________________________________ ERROR at setup of test_custom_greeting ______________________________________

request = <SubRequest 'project' for <Function 'test_custom_greeting'>>
pytestconfig = <_pytest.config.Config object at 0x7fd997d59b00>

@pytest.fixture()
def project(request, pytestconfig):
    project_dir = get_populus_option(
        cmdline_option="--populus-project",
        ini_option="populus_project",
        environ_var="PYTEST_POPULUS_PROJECT",
        pytestconfig=pytestconfig,
        default=os.getcwd(),
    )

    if not os.path.exists(get_json_config_file_path(project_dir)):
        raise FileNotFoundError(
            "No populus project found for testing in {project_dir}".format(
              project_dir=project_dir
            )
        )

E FileNotFoundError: No populus project found for testing in /home/solidity/Documents/testing

/usr/lib/python3.6/site-packages/populus-2.2.0-py3.6.egg/populus/plugin.py:60: FileNotFoundError
============================================= 2 error in 0.04 seconds ==============================================
[

@dangell7

This comment has been minimized.

Copy link

commented Jan 12, 2018

Did you ever find the fix for this? I just ran into the same error

@dangell7

This comment has been minimized.

Copy link

commented Jan 12, 2018

I'd like to use this, however, if its not going to work, I'll just go back to truffle... lol

@postables

This comment has been minimized.

Copy link
Author

commented Jan 12, 2018

No unfortunately I did not. Ive also run into breaking bugs with this and web3py which is a shame all the Python tools for Ethereum are quite honestly garbage

@dangell7

This comment has been minimized.

Copy link

commented Jan 13, 2018

@dangell7

This comment has been minimized.

Copy link

commented Jan 13, 2018

And yeah, I have too. What problems are you having with web3.py? I’ve fixed most of mine so far, so maybe I can help you?

@dangell7

This comment has been minimized.

Copy link

commented Jan 13, 2018

Also, when you copy the json file, make sure you read the notes, as the json has to be at the root project level.

@postables

This comment has been minimized.

Copy link
Author

commented Jan 18, 2018

@harpangell7 I was able to get the tests running by following the instructions in issue #414 However I get the following error now

==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.6.3, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /home/solidity/testing/tests, inifile:
plugins: xdist-1.18.1, hypothesis-3.44.16, populus-2.2.0
collected 2 items                                                                                                                                                                             

test_greeter.py FF

========================================================================================== FAILURES ==========================================================================================
________________________________________________________________________________________ test_greeter ________________________________________________________________________________________

chain = <populus.chain.tester.TesterChain object at 0x7f6446942e10>

    def test_greeter(chain):
>       greeter, _ = chain.provider.get_or_deploy_contract('Greeter')

test_greeter.py:2: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.6/dist-packages/populus-2.2.0-py3.6.egg/populus/contracts/provider.py:146: in get_or_deploy_contract
    deploy_kwargs=deploy_kwargs,
/usr/local/lib/python3.6/dist-packages/populus-2.2.0-py3.6.egg/populus/contracts/provider.py:115: in deploy_contract
    contract_data = self.get_contract_data(contract_identifier)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <populus.contracts.provider.Provider object at 0x7f643e5c4eb8>, contract_identifier = 'Greeter'

    def get_contract_data(self, contract_identifier):
        """
            Returns a dictionary containing the compiler output for the given
            contract identifier.
            """
        for backend in self.provider_backends.values():
            try:
                return backend.get_contract_data(contract_identifier)
            except UnknownContract:
                continue
        else:
            raise UnknownContract(
                "No contracts found for the contract identifier '{0}'".format(
>                   contract_identifier,
                )
            )
E           populus.contracts.exceptions.UnknownContract: No contracts found for the contract identifier 'Greeter'

/usr/local/lib/python3.6/dist-packages/populus-2.2.0-py3.6.egg/populus/contracts/provider.py:174: UnknownContract
____________________________________________________________________________________ test_custom_greeting ____________________________________________________________________________________

chain = <populus.chain.tester.TesterChain object at 0x7f643e630160>

    def test_custom_greeting(chain):
>       greeter, _ = chain.provider.get_or_deploy_contract('Greeter')

test_greeter.py:9: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.6/dist-packages/populus-2.2.0-py3.6.egg/populus/contracts/provider.py:146: in get_or_deploy_contract
    deploy_kwargs=deploy_kwargs,
/usr/local/lib/python3.6/dist-packages/populus-2.2.0-py3.6.egg/populus/contracts/provider.py:115: in deploy_contract
    contract_data = self.get_contract_data(contract_identifier)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <populus.contracts.provider.Provider object at 0x7f643e642b38>, contract_identifier = 'Greeter'

    def get_contract_data(self, contract_identifier):
        """
            Returns a dictionary containing the compiler output for the given
            contract identifier.
            """
        for backend in self.provider_backends.values():
            try:
                return backend.get_contract_data(contract_identifier)
            except UnknownContract:
                continue
        else:
            raise UnknownContract(
                "No contracts found for the contract identifier '{0}'".format(
>                   contract_identifier,
                )
            )
E           populus.contracts.exceptions.UnknownContract: No contracts found for the contract identifier 'Greeter'

/usr/local/lib/python3.6/dist-packages/populus-2.2.0-py3.6.egg/populus/contracts/provider.py:174: UnknownContract
================================================================================== 2 failed in 0.35 seconds ==================================================================================
@dangell7

This comment has been minimized.

Copy link

commented Jan 25, 2018

Did you get this fixed?

@Machine-Hum

This comment has been minimized.

Copy link

commented Jan 29, 2018

Is there a fix for this?

@postables

This comment has been minimized.

Copy link
Author

commented Feb 10, 2018

No never found a fix

@veox

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2018

Likely duplicate of #414 (EDIT: ah, has been mentioned).

@mandarvaze

This comment has been minimized.

Copy link
Contributor

commented Feb 23, 2018

I ran across the error reported at the beginning of this issue i.e. FileNotFoundError: No populus project found for testing in ..
After applying the "fix" from #414 - the error went away.
I did not encounter any other error, and the tests passed.

@arpi9211

This comment has been minimized.

Copy link

commented Feb 17, 2019

Populus Version: 2.2.0
OS: osx

Problem:
FileNotFoundError: No populus project found for testing in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/populus/plugin.py:60

Solution:
when we run $ populus init command it will Wrote default populus configuration file at this location /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/populus/assets/defaults.v8.config.json

copy defaults.v8.config.json file and paste it on your project and rename defaults.v8.config.json to project.json file. This solution solved the issue for me

@postables

This comment has been minimized.

Copy link
Author

commented Feb 25, 2019

@postables postables closed this Feb 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.