nestorsalceda / mamba

The definitive testing tool for Python. Born under the banner of Behavior Driven Development (BDD).
http://nestorsalceda.github.io/mamba
MIT License
520 stars 64 forks source link

Basic implementation for exported_context. #129

Open Askir opened 5 years ago

Askir commented 5 years ago

Alright as the title suggests this implementation has quite a few limitations. But I hope I can get some feedback on how to go from here.

Limitations are:

I've added pending tests for both scenarios.

Once finished this should implement #128

kfischer-okarin commented 5 years ago

Looks like a good start to me, though from my point of view there is still a bit of work to do before this will work

Askir commented 5 years ago

@DerTraveler Pretty certain that wont work, good catch! So you suggest I implement a collect_exported_contexts() method to scan all the modules for exported contexts first?
That would fix the load order limitation but wont fix contexts including each other and also will not fix the namespace problem.

As an idea: If I save the filepath for each exported context, when including that context I could programmatically add an import statement for that file.

On a more general note: I'm a little bit surprised that mamba is implemented with custom ast parsing. I am pretty sure that RSPEC for example is not implemented with custom parsing. And I thought by using pythons with clause mamba would have an easier time to do things like this as we wouldn't be having to re-implement core python functionality like imports.

Is there a specific reason for this? Is it easier to write the custom parser than for example, creating shared_contexts with the method call shared_context() and saving them in a singleton-like structure? Not sure if you are the correct person to ask for a decision like this :D

maximderbin commented 4 years ago

any progress on it? or this PR is dead?

Askir commented 4 years ago

@maximderbin

any progress on it? or this PR is dead?

I'm still alive but the PR is pretty dead 😅. Haven't worked on this in years basically.